#include <bits/stdc++.h>
using namespace std;
long long tot(long long first) {
  if (first <= 1) {
    return 1;
  }
  return 2 * tot(first / 2) + 1;
}
long long cnt(long long first, long long l, long long r, long long u,
              long long v) {
  if (v < l || u > r) {
    return 0;
  }
  if (first <= 1) {
    return first;
  }
  long long m = (u + v) / 2;
  long long ret =
      cnt(first / 2, l, r, u, m - 1) + cnt(first / 2, l, r, m + 1, v);
  if (l <= m && m <= r) {
    ret += first & 1;
  }
  return ret;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  long long first, l, r;
  cin >> first >> l >> r;
  cout << cnt(first, l, r, 1, tot(first));
  return 0;
}
