#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, l, r;
  cin >> n >> l >> r;
  vector<int> bit;
  int last = 0;
  if (n == 0) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 0; i <= 50; i++) {
    if ((1ll << i) & n) {
      bit.push_back(1);
      last = i;
    } else
      bit.push_back(0);
  }
  int cnt = 0;
  for (long long i = l; i <= r; i++) {
    if (i % 2)
      cnt++;
    else {
      for (long long j = 1; j <= 51 && last - j >= 0; j++) {
        if (i % (1ll << (j + 1)) == (1ll << j)) {
          cnt += bit[last - j];
          break;
        }
      }
    }
  }
  cout << cnt << endl;
}
