#include <bits/stdc++.h>
using namespace std;
long long solve(long long a, long long b, long long n, long long l,
                long long r) {
  if (b <= l || r <= a) return 0;
  if (a <= l && r <= b) return n;
  long long mid = (l + r) / 2;
  long long lch = solve(a, b, n / 2, l, mid);
  long long rch = solve(a, b, n / 2, mid + 1, r);
  long long ret = lch + rch;
  if (a <= mid && mid < b) ret += n & 1;
  return ret;
}
int main() {
  long long n, l, r;
  scanf("%lld%lld%lld", &n, &l, &r);
  long long p = 1;
  while (p <= n) {
    p <<= 1;
  }
  long long ans = solve(l - 1, r, n, 0, p - 1);
  printf("%lld\n", ans);
}
