#include <bits/stdc++.h>
using namespace std;
long long int lg = 0;
long long int n, l, r, cnt = 0;
void first(long long int k, long long int lo, long long int hi) {
  if (l > hi or r < lo) return;
  if (k == 1) cnt++;
  if (k == 1 or k == 0) return;
  long long int md = (lo + hi) / 2;
  first(k / 2, lo, md - 1);
  first(k % 2, md, md);
  first(k / 2, md + 1, hi);
}
int main() {
  cin >> n >> l >> r;
  long long int p = n;
  lg = 1;
  while (lg <= p) {
    lg *= 2;
  }
  lg--;
  first(n, 1, lg);
  cout << cnt << endl;
}
