#include <bits/stdc++.h>
using namespace std;
long long count(long long l, long long r, long long L, long long R,
                long long k) {
  if (l == r) return k;
  long long ans = 0;
  long long mid = ((l + r) >> 1);
  if (L < mid) ans += count(l, mid - 1, L, R, (k >> 1));
  if (R > mid) ans += count(mid + 1, r, L, R, (k >> 1));
  if (mid >= L && mid <= R) ans += (k % 2);
  return ans;
}
int main() {
  long long n, l, r;
  cin >> n >> l >> r;
  long long len = 1, t = n;
  while (t) {
    len <<= 1;
    t >>= 1;
  }
  if (n) len--;
  cout << count(1, len, l, r, n) << endl;
  return 0;
}
