#include <bits/stdc++.h>
const int INF = 0x3f3f3f3f;
const long long LLINF = 0x3f3f3f3f3f3f3f3f;
using namespace std;
long long n, l, r, a[110], t;
set<long long> s;
struct aa {
  long long sum, f;
} sum[110];
long long meg(long long val) {
  long long cnt = 0;
  while (val) {
    val /= 2;
    cnt++;
  }
  if (pow(2, cnt) == val) return cnt;
  return cnt - 1;
}
long long rifa(long long cur, long long p) {
  if (cur == -1) return 0;
  if (s.count(p)) {
    return sum[cur].sum;
  }
  long long tmp = p - a[cur];
  return rifa(meg(tmp), tmp) + sum[cur].sum;
}
void cal(long long val, long long cur) {
  if (val <= 1) return;
  cal(val / 2, cur - 1);
  if (sum[cur - 1].f) {
    sum[cur].sum += (sum[cur - 1].sum - 1) * 2 + sum[cur - 1].f;
  } else {
    sum[cur].sum += (sum[cur - 1].sum) * 2;
  }
  if (val & 1) {
    sum[cur].sum++;
    sum[cur].f = 1;
  }
}
int main() {
  ;
  long long tmp = 1, cnt = 0;
  while (cnt < 61) {
    s.insert(tmp);
    a[cnt] = tmp;
    tmp *= 2;
    cnt++;
  }
  sum[0].sum = 1;
  sum[0].f = 1;
  cin >> n >> l >> r;
  if (n == 0) {
    cout << "0\n";
    return 0;
  }
  long long t1 = meg(l - 1), t2 = meg(r);
  cal(n, meg(n));
  long long ans1 = rifa(t1, l - 1), ans2 = rifa(t2, r);
  cout << ans2 - ans1 << endl;
  return 0;
}
