#include <bits/stdc++.h>
using namespace std;
long long x, l, r, cnt = 0, s[64];
long long solve(long long n) {
  long long c = 0, t = n, a = x;
  while (t % 2 == 0) {
    c++;
    t /= 2;
  }
  return s[cnt - c];
}
int main() {
  cin >> x >> l >> r;
  long long sum = 0, js = x;
  while (js > 1) {
    s[cnt++] = js % 2;
    js /= 2;
  }
  for (long long i = l; i <= r; i++) {
    if (i % 2)
      sum += js;
    else
      sum += solve(i);
  }
  cout << sum << endl;
}
