#include <bits/stdc++.h>
using namespace std;
map<long long, long long> cnt;
long long countf(long long n) {
  if (cnt[n] > 0) {
    return cnt[n];
  } else {
    cnt[n] = 2 * countf(n / 2) + 1;
    return cnt[n];
  }
}
int main() {
  long long l, r, n;
  cnt[1] = 1;
  cnt[0] = 1;
  cin >> n >> l >> r;
  vector<long long> a;
  a.clear();
  a.push_back(n);
  countf(n);
  l -= 2;
  l++;
  while (l > 0) {
    if (l < cnt[a.back()]) {
      long long x = a.back();
      a.pop_back();
      a.push_back(x / 2);
      a.push_back(x % 2);
      a.push_back(x / 2);
    } else {
      l -= cnt[a.back()];
      r -= cnt[a.back()];
      a.pop_back();
    }
  }
  int cnt2 = 0;
  int ed2 = 0;
  while (cnt2 < r) {
    if (a[a.size() - 1] > 1) {
      long long x = a[a.size() - 1];
      a.pop_back();
      a.push_back(x / 2);
      a.push_back(x % 2);
      a.push_back(x / 2);
    } else {
      cnt2++;
      ed2 += a[a.size() - 1];
      a.pop_back();
    }
  }
  cout << ed2;
  return 0;
}
