#include <bits/stdc++.h>
int64_t get_value(int64_t n, int64_t k, int64_t m) {
  assert(k > 0);
  assert(m > 0);
  int64_t l = (int64_t(1) << (k - 1));
  if (m < l) return get_value(n / 2, k - 1, m);
  if (m == l) return n & 1;
  return get_value(n / 2, k - 1, m - l);
}
int main() {
  int64_t n, l, r;
  std::cin >> n >> l >> r;
  int64_t k = 0;
  int64_t n2 = n;
  while (n2 > 0) {
    ++k;
    n2 /= 2;
  }
  k = std::max<int64_t>(k, 1);
  int64_t res = 0;
  for (int64_t i = l; i <= r; ++i) res += get_value(n, k, i);
  std::cout << res << '\n';
}
