#include <bits/stdc++.h>
using namespace std;
long long n, l, r, ans = 0;
int get(long long a) {
  for (int i = 0, __ = 51; i < __; ++i) {
    if ((1LL << i) & a) return i;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> l >> r;
  if (n == 0) {
    cout << 0 << endl;
    return 0;
  }
  int maior = 0;
  for (int i = 0, __ = 51; i < __; ++i) {
    if ((1LL << i) & n) maior = i;
  }
  for (long long i = l; i <= r; ++i) {
    ans += (n >> (maior - get(i))) & 1;
  }
  cout << ans << endl;
  return 0;
}
