#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
map<long long, long long> cnt;
long long fin(long long x) {
  if (cnt[x] != 0) return cnt[x];
  if (x == 0 or x == 1) {
    cnt[x] = 1;
    return 1;
  }
  cnt[x] = fin(x / 2) + fin(x % 2) + fin(x / 2);
  return cnt[x];
}
long long ix(long long n, long long target) {
  if (n <= 1) return n;
  long long li, md;
  li = fin(n / 2);
  md = li + 1;
  if (li >= target) {
    return ix(n / 2, target);
  }
  if (md >= target) {
    return n % 2;
  }
  return ix(n / 2, target - md);
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long n, l, r;
  cin >> n >> l >> r;
  fin(n);
  long long sum = 0;
  for (long long j = l; j <= r; j++) {
    sum += ix(n, j);
  }
  cout << sum;
  return 0;
}
