#include <bits/stdc++.h>
long long len(long long x) {
  if (x <= 1) return 1;
  return len(x >> 1) << 1 | 1;
}
long long solve(long long x, long long n, long long l) {
  if (!n || !x) return 0;
  if (x == 1) return 1;
  if (n <= l) return solve(x >> 1, n, l >> 1);
  if (n == l + 1) return (x >> 1) + (x & 1);
  return (x >> 1) + (x & 1) + solve(x >> 1, n - l - 1, l >> 1);
}
long long solve(long long x, long long n) { return solve(x, n, len(x >> 1)); }
int main() {
  long long n, l, r;
  scanf("%lld%lld%lld", &n, &l, &r);
  printf("%lld\n", solve(n, r) - solve(n, l - 1));
  return 0;
}
