#include <bits/stdc++.h>
using namespace std;
int INF = 1e9;
int main() {
  ios_base::sync_with_stdio(0);
  long long n, l, r;
  cin >> n >> l >> r;
  if (n < 2) {
    cout << n << endl;
    return 0;
  }
  long long kol0 = 0, n1 = n, step = 1;
  while (n1 != 1) {
    if (n1 % 2 == 0) {
      kol0 += step;
    }
    step *= 2;
    n1 /= 2;
  }
  long long ans = 0;
  for (long long i = l; i <= r; i++) {
    long long un = n + kol0, poz = i;
    n1 = n;
    bool pr = false;
    while (!pr) {
      if (n1 < 2) {
        if (n1 == 1) {
          ans++;
        }
        pr = true;
      } else if (poz == un / 2 + 1) {
        if (n1 % 2 == 1) {
          ans++;
        }
        pr = true;
      } else {
        if (poz >= un / 2 + 1) {
          poz -= un / 2 + 1;
        }
        n1 /= 2;
        un /= 2;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
