#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, l, r;
  cin >> n >> l >> r;
  vector<long long> v;
  v.clear();
  while (n > 0) {
    if (n % 2 == 1)
      v.push_back(1);
    else
      v.push_back(0);
    n /= 2;
  }
  reverse(v.begin(), v.end());
  l--;
  long long p = 1;
  long long ans = 0;
  for (int i = 0; i < v.size(); i++) {
    if (v[i] > 0) {
      long long temp = p * 2ll;
      long long left = max(0ll, l - p);
      long long right = max(0ll, r - p);
      left /= temp;
      right /= temp;
      if (l >= p) left++;
      if (r >= p) right++;
      ans += right - left;
    }
    p *= 2ll;
  }
  cout << ans << endl;
  return 0;
}
