#include <bits/stdc++.h>
using namespace std;
int a[100];
int main() {
  long long n, l, r;
  cin >> n >> l >> r;
  if (n == 0) return 0 * printf("0\n");
  int i = 0;
  while (n) {
    a[i++] = n % 2;
    n >>= 1;
  }
  i--;
  int len = i;
  int sum = (r - l + 1) / 2;
  if (((r - l + 1) & 1) && r & 1) sum++;
  long long s = l & 1 ? l + 1 : l;
  for (; s <= r; s += 2) {
    for (i = 0; i < len; i++) {
      if ((s - (1LL << len - i)) % (1LL << len - i + 1) == 0) sum += a[i];
    }
  }
  printf("%d\n", sum);
  return 0;
}
