#include <bits/stdc++.h>
using namespace std;
long long n, l, r;
int ans, x;
int solve(long long x, long long pos) {
  long long n = x, tmp = 1ll, tmp2 = 0ll;
  while (n > 1ll) {
    n /= 2ll;
    tmp *= 2ll;
    tmp2++;
  }
  tmp = tmp * 2ll - 1ll;
  tmp2++;
  long long p = pos;
  n = x;
  for (int i = (tmp2); i >= (0); i--) {
    if (p * 2ll - 1ll == tmp)
      return n % 2ll;
    else if (p > tmp / 2ll)
      p = (tmp / 2ll + 1ll) * 2ll - p;
    tmp /= 2ll;
    n /= 2ll;
  }
}
int main() {
  scanf("%lld %lld %lld", &n, &l, &r);
  for (long long i = l; i <= r; i++) {
    x = solve(n, i);
    ans += solve(n, i);
  }
  printf("%d\n", ans);
  return 0;
}
