#include<stdio.h> int main(){ int n,L,R,c=0; scanf("%d%d%d",&n,&L,&R); if(L%n>R%n){ c=n-1; } else{ c=L%n; } printf("%d",c); return 0; }