#include <bits/stdc++.h>
const long long maxn = 1e6 + 9, modn = 1e9 + 7;
using namespace std;
long long n, l, r, ans, a[51];
long long solve(long long k) {
  for (long long i = 50; i > -1; i--) {
    if ((1ll << i) == k) {
      k = i;
      break;
    }
    if ((1ll << i) < k) k -= (1ll << i);
  }
  if (a[k] % 2)
    return 1;
  else
    return 0;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> l >> r;
  if (n == 0) {
    cout << 0;
    return 0;
  }
  ans += (r + 1) / 2 - l / 2;
  for (long long i = log2(n); i > 0; i--) {
    a[i] = n;
    n /= 2;
  }
  for (long long i = l; i <= r; i++) {
    if (i % 2)
      continue;
    else if (solve(i) == 1) {
      ans++;
    }
  }
  cout << ans;
  return 0;
}
