#include <bits/stdc++.h>
using namespace std;
map<long long, long long> cnt;
map<long long, long long> size;
long long ans;
void solve(long long n, long long l, long long r, long long start,
           long long end) {
  if (start > r || end < l) {
    return;
  }
  if (l <= start && r >= end) {
    ans += cnt[n];
    return;
  }
  long long halfSize = size[n / 2];
  solve(n / 2, l, r, start, start + halfSize - 1);
  solve(n % 2, l, r, start + halfSize, start + halfSize);
  solve(n / 2, l, r, start + halfSize + 1, end);
}
void calCnt(long long n) {
  if (n <= 1) {
    cnt[n] = n;
    size[n] = 1;
    return;
  }
  calCnt(n / 2);
  cnt[n] = 2 * cnt[n / 2] + n % 2;
  size[n] = 2 * size[n / 2] + 1;
}
int main() {
  {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  };
  long long n, l, r;
  cin >> n >> l >> r;
  calCnt(n);
  solve(n, l, r, 1, size[n]);
  cout << ans << endl;
  return 0;
}
