#include <bits/stdc++.h>
using namespace std;
long long lvl[100];
long long lvl_v[100], lvl_md[100];
int main() {
  lvl[1] = 1;
  for (int i = 2; i <= 55; i++) {
    lvl[i] = lvl[i - 1] * 2 + 1;
  }
  long long n, r, l;
  scanf("%lld %lld %lld", &n, &l, &r);
  long long temp = n;
  lvl_v[1] = n;
  long long idx = 2;
  while (temp > 1) {
    lvl_v[idx] = temp / 2, lvl_md[idx] = temp % 2;
    idx++;
    temp /= 2;
  }
  int tot = 0;
  for (long long i = l; i <= r; i++) {
    long long lo = 1, hi = lvl[idx - 1], mid;
    temp = n;
    int cnt = 50, md = 0;
    while (lo <= hi) {
      mid = (lo + hi) / 2;
      if (mid == i) {
        md = temp % 2;
        break;
      }
      if (i < mid) {
        hi = mid - 1;
      } else {
        lo = mid + 1;
      }
      temp = temp / 2;
    }
    tot = tot + md;
  }
  printf("%d", tot);
}
