#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
long long getSize(long long num) {
  if (num <= 1) return 1;
  return 2 * getSize(num / 2) + 1;
}
long long l, r;
long long solve(long long n, long long cl, long long cr) {
  if (cl > r or cr < l) return 0;
  if (!n) return 0;
  if (cl > cr) return 0;
  long long ret = 0;
  long long mid = (cl + cr) / 2;
  if (mid >= l and mid <= r and n & 1) ret++;
  ret += solve(n / 2, cl, mid - 1);
  ret += solve(n / 2, mid + 1, cr);
  return ret;
}
const long long N = 5e5 + 5;
int main() {
  ios_base::sync_with_stdio(false);
  long long n, t, m, k, ans, i, j, res = 0, fl;
  t = 1;
  while (t--) {
    cin >> n >> l >> r;
    long long siz = getSize(n);
    cout << solve(n, 1, siz) << '\n';
  }
  return 0;
}
