#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1.0);
const int MAXN = 200001;
int a[MAXN];
const int INF = 2000 * 1000 * 1000 + 2;
int main() {
  ios_base::sync_with_stdio(0);
  long long n;
  long long l;
  long long r;
  int bt = 1;
  cin >> n >> l >> r;
  while ((1ll << bt) <= n) bt++;
  int ans = 0;
  for (long long i = l; i <= r; i++) {
    long long x = i;
    for (int j = bt - 1; j >= 0; j--) {
      long long d = (1ll << j) - 1;
      if (x <= d)
        continue;
      else if (x == d + 1) {
        ans += ((n >> (bt - 1 - j)) & 1);
        break;
      } else
        x -= (d + 1);
    }
  }
  cout << ans << endl;
  return 0;
}
