#include <bits/stdc++.h>
using namespace std;
long long solve(long long l, long long r, long long n) {
  if (n == 0) return 0;
  long long log = 0;
  for (; (1LL << log) <= n / 2; log++)
    ;
  log--;
  long long qtd = 0;
  for (long long i = 0; i <= log; i++) qtd += (1LL << i);
  long long sum = 0;
  if (l <= qtd) sum += solve(l, r, n / 2);
  if (l <= qtd + 1 and r >= qtd + 1) sum += (n % 2);
  if (r > qtd + 1) sum += solve(max(0LL, l - qtd - 1), r - qtd - 1, n / 2);
  return sum;
}
int main() {
  long long n, l, r;
  cin >> n >> l >> r;
  cout << solve(l, r, n) << "\n";
  return 0;
}
