#include <bits/stdc++.h>
using namespace std;
;
long long getOneNum(long long n, long long a, long long b, long long l,
                    long long r) {
  long long mid;
  long long one_num = 0;
  if (a > b || l > r) return one_num;
  mid = (a + b) / 2;
  if (mid > r)
    one_num += getOneNum(n / 2, a, mid - 1, l, r);
  else if (mid < l)
    one_num += getOneNum(n / 2, mid + 1, b, l, r);
  else {
    one_num += n % 2;
    one_num += getOneNum(n / 2, a, mid - 1, l, mid - 1);
    one_num += getOneNum(n / 2, mid + 1, b, mid + 1, r);
  }
  return one_num;
}
int main() {
  long long n, l, r;
  long long i = 1, length = 1;
  long long num;
  cin >> n >> l >> r;
  if (n >= 2) {
    while (1) {
      if (pow(2, i) <= n && n < pow(2, i + 1)) {
        length = pow(2, i + 1) - 1;
        break;
      }
      i++;
    }
  }
  num = getOneNum(n, 1, length, l, r);
  cout << num << endl;
  return 0;
}
