#include <bits/stdc++.h>
using namespace std;
long long r, l;
long long sum(long long n, long long left, long long right) {
  long long mid = (right + left) >> 1;
  if (right < l || left > r) return 0;
  if (right <= r && left >= l) return n;
  return sum(n >> 1, left, mid - 1) + (mid >= l && mid <= r ? n % 2 : 0) +
         sum(n >> 1, mid + 1, right);
}
int main() {
  long long n, size = 1;
  cin >> n >> l >> r;
  while (n >= size) {
    size <<= 1;
  }
  cout << sum(n, 1, size - 1) << endl;
}
