#include <bits/stdc++.h>
using namespace std;
int count(long long int index, long long int n) {
  long long int elemCount = 1;
  do {
    elemCount *= 2;
  } while (elemCount <= n);
  elemCount--;
  long long int mid = (elemCount + 1) / 2;
  long long int currentIndex = mid;
  long long int value = n;
  long long int restTree = 0;
  long long int add = mid / 2;
  while (true) {
    if (currentIndex == index) break;
    value /= 2;
    if (currentIndex > index) {
      if (add > 0) add *= -1;
    } else if (currentIndex < index) {
      if (add < 0) add *= -1;
    }
    currentIndex += add;
    add /= 2;
  }
  return value % 2;
}
int main() {
  long long int n, l, r, ans = 0;
  cin >> n >> l >> r;
  for (long long int x = l; x <= r; x++) {
    ans += count(x, n);
  }
  cout << ans << endl;
}
