#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, r, l;
  cin >> n >> l >> r;
  if (n == 0) {
    cout << 0 << endl;
    return 0;
  }
  int m = 52;
  while (((n >> m) & 1) == 0) m--;
  int ans = 0;
  for (long long i = l; i <= r; i++) {
    int x = 0;
    while (((i >> x) & 1) == 0) x++;
    x = m - x;
    ans += ((n >> x) & 1);
  }
  cout << ans << endl;
  return 0;
}
