#include <bits/stdc++.h>
using namespace std;
long long n;
long long l, r;
long long ret = 0;
long long u;
long long count(long long x) {
  if (x <= 1) return 1;
  long long res = count(x / 2);
  res *= 2;
  res++;
  return res;
}
long long solve(long long x) {
  if (u == 0) return 0;
  if (x == 0) return 0;
  if (x == 1) {
    u--;
    return 1;
  }
  long long res = solve(x / 2);
  long long temp = res;
  long long c = count(x / 2);
  if (u == 0) return res;
  if (x % 2 == 1) {
    res += 1;
  }
  u--;
  if (u == 0) return res;
  if (u >= c) {
    u -= c;
    res += temp;
  } else
    res += solve(x / 2);
  return res;
}
int main() {
  scanf("%I64d %I64d %I64d", &n, &l, &r);
  long long x1, x2;
  ret = 0;
  u = r;
  long long res = solve(n);
  x1 = res;
  u = l - 1;
  x2 = solve(n);
  cout << x1 - x2 << endl;
  return 0;
}
