#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int md = 3e5;
long long l, r;
long long n;
vector<int> v, an;
int main() {
  cin >> n >> l >> r;
  if (n < 2) {
    if (l == 1) {
      cout << n;
    } else
      cout << 0;
    return 0;
  }
  long long tmp = n;
  int f1 = -1;
  while (tmp) {
    if (tmp == 2) {
      f1 = 0;
      break;
    } else if (tmp == 3) {
      f1 = 1;
      break;
    }
    v.push_back(tmp % 2);
    tmp >>= 1;
  }
  int tot = 0;
  for (long long i = l; i <= r; i++) {
    long long l1 = i % 4;
    if (l1 == 1)
      tot++;
    else if (l1 == 3)
      tot++;
    else if (l1 == 2)
      tot += f1;
    else {
      l1 = i / 4;
      for (int j = 0; j < v.size(); j++) {
        long long p1 = 1ll << j, p2 = 1ll << (j + 1);
        if ((l1 - p1) % p2 == 0) tot += v[v.size() - 1 - j];
      }
    }
  }
  cout << tot;
  return 0;
}
