#include< bits/stdc++.h>
using namespace std;
int generate(int s,int e,int l,int r, int n){
// when s=e and in range of l and r
if((s==e)&&(s>=l&&s<=r)){
return n%2;
}
//no overlap
if(s>r||e<l){
return 0;
}
// complete overlap or partial
int mid=(s+e)/2;
int left=generate(s,mid-1,l,r,n/2);
int right=generate(mid+1,e,l,r,n/2);
return left+right+(n%2&&(s<=l&&r<=e));
}
int main()
{
long long int n,l,r,count=0;
cin>>n>>l>>r;
int e=int(ceil(log2(n)));
e=1<<e;
e=e-2;
int s=generate(0,e,l,r,n);
cout<<s;
return 0;
}