#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, l, r, j;
  cin >> n >> l >> r;
  long long int m = n, ct = 0;
  if (n == 0) {
    cout << 0 << endl;
    return 0;
  }
  vector<long long int> v;
  while (m > 0) {
    v.push_back(m % 2);
    m = m / 2ll;
  }
  m = n;
  reverse(v.begin(), v.end());
  for (long long int i = l; i <= r; i++) {
    long long int p;
    for (p = 0; p <= 50; p++) {
      long long int num = pow(2ll, p);
      j = i / num;
      j++;
      if (j % 2 == 0) {
        long long int bit = v[p];
        if (bit == 1) ct++;
        break;
      }
    }
  }
  cout << ct << endl;
  return 0;
}
