#include
#include
using namespace std;
map<int ,int> ans;
int index = 0;
void cal(int n){
if(n==1 || n==0)
{
ans[index] = n;
index++;
return;
}
cal(n/2);
cal(n%2);
cal(n/2);
}
int main()
{
int n,l,r;
cin>>n>>l>>r;
cal(n);
int count_=0;
int i=0;
for(auto a:ans){
if(i>=l and i<=r){
if(a.second == 1){
count_++;
}
}
i++;
}
cout<<count_<<endl;
}