#include <bits/stdc++.h>
using namespace std;
const double PI = 3.141592653589793238;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= 1000000007;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
  }
  return res;
}
long long n, l, r, arr[200005];
int ind;
int sol1(long long n) {
  if (n == 1) return 1;
  int bit = 0;
  long long one = 1ll;
  while (1) {
    if (one << bit > n) return bit - 1;
    bit++;
  }
}
long long solve(long long range) {
  long long sum = 0;
  long long one = 1ll;
  while (range > 0) {
    int bit = sol1(range);
    sum += arr[bit];
    range -= (long long)(one << bit);
    if (range >= 0 && arr[bit + 1] & 1) sum++;
  }
  return sum;
}
int main() {
  long long ans, num;
  cin >> n >> l >> r;
  num = n;
  while (num) {
    arr[++ind] = num;
    num >>= 1;
  }
  reverse(arr + 1, arr + ind + 1);
  if (!n)
    ans = 0;
  else
    ans = solve(r) - solve(l - 1);
  printf("%lld\n", ans);
  return 0;
}
