#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,l,r,k;
	cin>>n>>l>>r;
	k=2*n-1;
	while(1){
		if(k>r){
			cout<<r-k+n-1;
			break;
		}
		if(k>=l&&k<=r){
			cout<<n-1;
			break;
		}
		k+=n;
	}
	return 0;
}

/**************************************************************
	Problem: 2401
	User: zzz
	Language: C++
	Result: Accepted
	Time:41 ms
	Memory:2072 kb
****************************************************************/