#include <bits/stdc++.h>
int const MAX = 1e6 + 1;
int const INF = 1 << 30;
using namespace std;
long long n, st, ed;
long long len = 1;
long long query(long long n, long long qlef, long long qrig, long long lef,
                long long rig) {
  if (lef > qrig || rig < qlef || n == 0) return 0;
  if (n == 1) return 1;
  long long mid = (lef + rig) >> 1;
  return query(n / 2, qlef, qrig, lef, mid - 1) +
         query(n % 2, qlef, qrig, mid, mid) +
         query(n / 2, qlef, qrig, mid + 1, rig);
}
int main(int argc, char* argv[]) {
  cin >> n >> st >> ed;
  long long t = n;
  while (t > 1) {
    len = 2 * len + 1;
    t >>= 1;
  }
  printf("%lld\n", query(n, st, ed, 1, len));
  return 0;
}
