#include <bits/stdc++.h>
using namespace std;
long long calc(long long x) {
  if (x == 0) return 1;
  long long y = 1;
  while (x >= y) y <<= 1;
  return y - 1LL;
}
int solve(long long n, long long l, long long r, long long o) {
  if (n <= 1) {
    return n;
  }
  long long n1 = n / 2;
  long long n2 = n % 2;
  long long n3 = n / 2;
  long long nn1 = calc(n1) + o;
  long long nn2 = calc(n2) + nn1;
  long long nn3 = calc(n3) + nn2;
  int res = 0;
  if (l <= nn1 && o < r) {
    res += solve(n1, l, r, o);
  }
  if (l <= nn2 && nn1 < r) {
    res += solve(n2, l, r, nn1);
  }
  if (l <= nn3 && nn2 < r) {
    res += solve(n3, l, r, nn2);
  }
  return res;
}
int main(int argc, char const* argv[]) {
  long long n, l, r;
  cin >> n >> l >> r;
  cout << solve(n, l, r, 0) << endl;
}
