#include <bits/stdc++.h>
long long count(int bytes, long long n, long long x) {
  long long answer;
  long long left = 1LL << (bytes - 1);
  if (x == 0) {
    answer = 0;
  } else if (n <= 1) {
    answer = n;
  } else if (x < left) {
    answer = count(bytes - 1, n / 2, x);
  } else if (x == left) {
    answer = (n / 2) + (n % 2);
  } else {
    answer = (n / 2) + (n % 2) + count(bytes - 1, n / 2, x - left);
  }
  return answer;
}
int main() {
  long long n, l, r;
  scanf("%I64d%I64d%I64d", &n, &l, &r);
  int bytes = 0;
  long long cn = n;
  while (cn > 0) {
    cn /= 2;
    bytes++;
  }
  long long answer = count(bytes, n, r) - count(bytes, n, l - 1);
  printf("%I64d\n", answer);
  return 0;
}
