#include <bits/stdc++.h>
using namespace std;
const int N3 = 1e3 + 15;
const int N4 = 1e4 + 15;
const int N5 = 1e5 + 15;
const int N6 = 1e6 + 15;
const int N7 = 1e7 + 15;
const int N8 = 1e8 + 15;
const int N9 = 1e9 + 15;
const double pi = acos(-1.0);
long long n, l, poww, last, ans, r;
int main() {
  cin >> n >> l >> r;
  for (poww = 1; poww <= (n >> 1); poww <<= 1)
    ;
  while (n) {
    long long modd = n % 2;
    long long act = r / poww - (l - 1) / poww;
    ans += max(0ll, (act * modd) - last);
    last = act;
    poww >>= 1;
    n >>= 1;
  }
  cout << ans;
}
