#include <bits/stdc++.h>
using namespace std;
long long n, ans, l, r, lenght = 1, a;
long long fz(long long ll, long long rr, long long n) {
  if (ll == rr) return n;
  long long mid = (ll + rr) >> 1;
  long long anss = 0;
  if (l < mid) anss += fz(ll, mid - 1, n >> 1);
  if (r > mid) anss += fz(mid + 1, rr, n >> 1);
  if (mid <= r && mid >= l) anss += (n % 2);
  return anss;
}
int main() {
  cin >> n >> l >> r;
  long long k = log2(n) + 1;
  long long temp = 2;
  if (n > 1)
    while (k) {
      if (k % 2) lenght *= temp;
      temp *= temp;
      k /= 2;
    }
  else
    lenght = 2;
  lenght--;
  cout << fz(1, lenght, n);
  return 0;
}
