#include <bits/stdc++.h>
using namespace std;
map<long long, long long> len;
map<long long, long long> jed;
long long licz(long long x) {
  if (x <= 1) {
    len[x] = x;
    jed[x] = (x == 1);
    return x;
  } else {
    long long res = 2 * licz(x / 2);
    res += 1;
    len[x] = res;
    long long il = 2 * jed[x / 2];
    if (x % 2 == 1) il++;
    jed[x] = il;
    return res;
  }
}
long long wynik = 0;
void f(long long l, long long r, long long war, long long p, long long k) {
  if (l <= p && k <= r) {
    wynik += jed[war];
    return;
  }
  long long le = (k - p) / 2;
  if (l <= p + le && p + le <= r && war % 2 == 1) wynik++;
  if (l <= p + le - 1) f(l, r, war / 2, p, p + le - 1);
  if (k - le + 1 <= r) f(l, r, war / 2, k - le + 1, k);
}
int main() {
  ios_base::sync_with_stdio(0);
  jed[0] = 0;
  len[0] = 1;
  long long n, l, r;
  cin >> n >> l >> r;
  licz(n);
  f(l, r, n, 1, len[n]);
  cout << wynik << endl;
  return 0;
}
