#include <bits/stdc++.h>
using namespace std;
int ans;
void solve(long long n, long long l1, long long r1, long long l, long long r) {
  if (n == 0 || l1 > r || r1 < l) return;
  long long mid = (l1 + r1) >> 1;
  if (mid >= l && mid <= r) ans += (n % 2);
  solve(n / 2, l1, mid - 1, l, r);
  solve(n / 2, mid + 1, r1, l, r);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, l, r;
  cin >> n, cin >> l, cin >> r;
  long long tmp = n, var = 0;
  while (tmp > 0) {
    tmp /= 2;
    var++;
  }
  long long num = (1LL << var) - 1;
  solve(n, 1, num, l, r);
  cout << ans << endl;
  return 0;
}
