#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f;
const unsigned long long INFL = (unsigned long long)1E18;
const int dir[4][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
unsigned long long cnt(unsigned long long temp) {
  unsigned long long x = 1;
  while (temp > 1) {
    temp /= 2;
    x += 1;
  }
  return x;
}
unsigned long long power(unsigned long long base, unsigned long long n) {
  if (n == 0LL) return 1LL;
  unsigned long long tmp = power(base, n / 2);
  unsigned long long now = tmp * tmp;
  if (n & 1) {
    now = base * now;
  }
  return now;
}
unsigned long long rec(unsigned long long now, unsigned long long left,
                       unsigned long long right, unsigned long long num) {
  if (left == right) return num;
  unsigned long long re = 0LL;
  unsigned long long nr = left + (right - left) / 2 - 1;
  unsigned long long nl = right - (right - left) / 2 + 1;
  unsigned long long off = num % 2;
  if (now <= nr)
    re = rec(now, left, nr, num / 2);
  else if (now == nr + 1)
    re = off;
  else
    re = rec(now, nl, right, num / 2);
  return re;
}
int main() {
  unsigned long long n, l, r;
  cin >> n >> l >> r;
  if (n == 0) {
    cout << 0 << endl;
    return 0;
  }
  unsigned long long total = power(2, cnt(n)) - 1;
  unsigned long long cont = 0;
  for (unsigned long long i = l; i <= r; i++) {
    cont += rec(i, 1, total, n);
  }
  cout << cont << endl;
  return 0;
}
