#include <bits/stdc++.h>
using namespace std;
long long solve(long long n, long long x, long long y) {
  if (y == 0) return 0;
  if (y == x / 2 + 1) return n / 2 + (n % 2);
  long long res = 0;
  if (y > x / 2 + 1) {
    res += n / 2;
    res += n % 2;
    res += solve(n / 2, x / 2, y - x / 2 - 1);
  } else
    res += solve(n / 2, x / 2, y);
  return res;
}
int main() {
  long long n, l, r;
  cin >> n >> l >> r;
  long long res = 1;
  while (res <= n) res *= 2;
  res--;
  long long c = solve(n, res, r);
  long long d = solve(n, res, l - 1);
  cout << c - d;
  return 0;
}
