#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long n, l, r;
  cin >> n >> l >> r;
  if (n == 0) {
    printf("0");
    return 0;
  } else if (n == 1) {
    printf("1");
    return 0;
  }
  vector<long long> vll;
  long long po2[100];
  int ct = 0;
  po2[ct] = 2;
  while (n > 1) {
    vll.push_back(n);
    n /= 2;
    ct++;
    po2[ct] = po2[ct - 1] * 2;
  }
  reverse(vll.begin(), vll.end());
  int tot = 0;
  for (long long i = r; i >= l; i--) {
    if (i % 2 == 1) {
      tot++;
      continue;
    }
    for (int j = ct; j >= 0; j--) {
      if (i % po2[j] == 0) {
        tot += (vll[j] % 2);
        break;
      }
    }
  }
  cout << tot;
  return 0;
}
