#include <bits/stdc++.h>
using namespace std;
const int max_n = 100010;
map<long long, long long> cnt;
long long init(long long n) {
  if (n <= 1) cnt[n] = 1;
  if (cnt[n]) return cnt[n];
  return (cnt[n] = 2ll * init(n >> 1) + 1ll);
}
long long sum(long long n, long long l) {
  if (l < 0) return 0ll;
  if (n <= 1ll) return n;
  if (l < cnt[n >> 1])
    return sum(n >> 1, l);
  else if (l == cnt[n >> 1])
    return ((n >> 1) + (n % 2ll));
  else
    return ((n >> 1) + (n % 2ll) + sum(n >> 1, l - cnt[n >> 1] - 1ll));
}
long long n, l, r;
int main() {
  cin >> n >> l >> r;
  --l;
  --r;
  init(n);
  cout << (sum(n, r) - sum(n, l - 1)) << "\n";
  return 0;
}
