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