#include <bits/stdc++.h>
using namespace std;
inline int nxt() {
  int first;
  scanf("%d", &first);
  return first;
}
int main() {
  long long n, l, r;
  cin >> n >> l >> r;
  vector<int> digits;
  while (n) {
    digits.push_back(n % 2);
    n /= 2;
  }
  if (digits.empty()) {
    digits.push_back(0);
  }
  reverse((digits).begin(), (digits).end());
  int ans = 0;
  for (long long i = l; i <= r; ++i) {
    ans += digits[__builtin_ctzll(i)];
  }
  printf("%d\n", ans);
  return 0;
}
