#include <bits/stdc++.h>
using namespace std;
long long bob_dosomething(long long n, long long L, long long R, long long l,
                          long long r) {
  if (n == 0 || L > r || R < l) return 0;
  if (n == 1) return 1;
  long long mid = pow(2, int(log2(n / 2)) + 1) - 1 + l;
  return bob_dosomething(n / 2, L, R, l, mid - 1) +
         bob_dosomething(n % 2, L, R, mid, mid) +
         bob_dosomething(n / 2, L, R, mid + 1, r);
}
int main() {
  long long n, l, r, s;
  cin >> n >> l >> r;
  s = pow(2, int(log2(n)) + 1) - 1;
  long long ans = bob_dosomething(n, l, r, 1, s);
  cout << ans;
  return 0;
}
