#include <bits/stdc++.h>
using namespace std;
long long n, l, r;
vector<long long> digit;
int main() {
  cin >> n >> l >> r;
  if (n == 0) digit.push_back(0);
  while (n > 0) {
    digit.push_back(n % 2);
    n >>= 1;
  }
  reverse(digit.begin(), digit.end());
  long long ans = 0;
  for (long long i = l; i <= r; i++) {
    long long pos = 0;
    long long tmp = i;
    while (!(tmp & 1)) pos++, tmp >>= 1;
    ans += digit[pos];
  }
  cout << ans << endl;
  return 0;
}
