#include <bits/stdc++.h>
using namespace std;
long long n, l, r;
long long f(long long m) {
  long long p = 1ll;
  for (int i = 1; i <= n; i++) {
    p *= 2LL;
    if (p > m) break;
  }
  return p - 1;
}
long long solve(long long x, long long y) {
  if (x == 1 && y == 1) return 1;
  long long k = f(x);
  if (k - y + 1 == k / 2 + 1) return x & 1;
  return solve(x / 2, min(k - y + 1, y));
}
int main() {
  long long i, j, res = 0;
  cin >> n >> l >> r;
  if (n == 0) {
    cout << "0";
    return 0;
  }
  if (n == 1) {
    cout << "1";
    return 0;
  }
  for (i = l; i <= r; i++) {
    res += solve(n, i);
  }
  cout << res;
  return 0;
}
