#include <bits/stdc++.h>
using namespace std;
long long N;
long long l;
long long r;
int lo = 0;
long long traverse(int level, long long N, long long l, long long r,
                   long long L, long long R) {
  long long M = (L + R) / 2;
  if (M < l)
    return traverse(level + 1, N / 2, l, r, M + 1, R);
  else if (M > r)
    return traverse(level + 1, N / 2, l, r, L, M - 1);
  long long rr = (N % 2);
  if (l < M) rr += traverse(level + 1, N / 2, l, M - 1, L, M - 1);
  if (r > M) rr += traverse(level + 1, N / 2, M + 1, r, M + 1, R);
  return rr;
}
int main() {
  cin >> N >> l >> r;
  long long n2 = N;
  while (n2 > 1) {
    n2 /= 2;
    lo++;
  }
  cout << traverse(0, N, l, r, 1, (1LL << (lo + 1)) - 1) << endl;
}
