#include <bits/stdc++.h>
using namespace std;
map<long long, long long> M;
long long f(long long n) {
  if (n == 1) {
    M[n] = 1;
    return 1;
  }
  M[n] = f(n / 2) * 2 + 1;
  return M[n];
}
long long calc(long long n, long long x) {
  if (x == 0) return 0;
  long long z = M[n / 2];
  if (x <= z) return calc(n / 2, x);
  if (x == z + 1) return n / 2 + (n % 2 == 1);
  return n / 2 + (n % 2 == 1) + calc(n / 2, x - z - 1);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, L, R;
  cin >> n >> L >> R;
  if (n == 0) {
    cout << 0 << endl;
    return 0;
  }
  f(n);
  cout << calc(n, R) - calc(n, L - 1) << endl;
  return 0;
}
