#include <bits/stdc++.h>
using namespace std;
long long Get(long long num, long long getfirst) {
  if (getfirst <= 0) return 0;
  if (num == 0) return 0;
  if (num == 1) return 1;
  long long len = 1;
  while (len <= (num >> 1LL)) len <<= 1LL;
  len--;
  if (len >= getfirst) {
    long long ret = Get(num >> 1LL, getfirst);
    return ret;
  }
  long long ret =
      (num >> 1LL) + (num & 1LL) + Get(num >> 1LL, getfirst - len - 1LL);
  return ret;
}
int main() {
  long long N, L, R;
  scanf("%lld %lld %lld", &N, &L, &R);
  long long whole = Get(N, R);
  long long sub = Get(N, L - 1LL);
  printf("%lld\n", whole - sub);
}
