#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
long long ans = 0;
void __pow() {
  long long j = 1;
  v.push_back(1);
  for (long long i = 1; i <= 52; i++) {
    j = j * 2;
    v.push_back(j);
  }
}
void solve(long long node, long long low, long long high, long long s,
           long long d) {
  if (s > d || low > d || high < s) return;
  long long mid = s + (d - s) / 2;
  if (node % 2 && mid >= low && mid <= high) ans++;
  node /= 2;
  solve(node, low, high, mid + 1, d);
  solve(node, low, high, s, mid - 1);
}
int main() {
  __pow();
  long long n, l, r, x, y, z;
  scanf("%lld", &n);
  scanf("%lld", &l);
  scanf("%lld", &r);
  x = upper_bound(v.begin(), v.end(), n) - v.begin();
  x = v[x - 1];
  solve(n, l, r, 1, x * 2);
  printf("%lld\n", ans);
}
