#include <bits/stdc++.h>
using namespace std;
long long int x, l, r, c;
long long int ret(long long int i, long long int cur, int level, int raise) {
  if (i == cur) {
    return ((x >> level) % 2);
  }
  long long int lr = 1ll << (raise - 1);
  if (i < cur) {
    return ret(i, cur - lr, level + 1, raise - 1);
  } else
    return ret(i, cur + lr, level + 1, raise - 1);
}
int main() {
  cin >> x >> l >> r;
  int len = 0;
  long long int xx = x;
  while (xx > 0) {
    xx /= 2;
    len++;
  }
  long long int key = (1ll << (len - 1));
  for (long long int i = l; i <= r; i++) {
    c += ret(i, key, 0, len - 1);
  }
  cout << c << endl;
  return 0;
}
