#include <bits/stdc++.h>
using namespace std;
const int MAXN = (1 << 20);
int64_t l, r, N;
void read() { cin >> N >> l >> r; }
int64_t query(int64_t pos, int64_t d, int64_t n) {
  if (d == 1) return n;
  int64_t subtree_size = (1ll << (d - 1ll)) - 1ll;
  if (pos <= subtree_size) return query(pos, d - 1, n >> 1ll);
  if (pos == subtree_size + 1) return (n & 1ll);
  return query(pos - subtree_size - 1, d - 1, n >> 1ll);
}
void solve() {
  int64_t lg = 0, nn = N;
  while (nn != 0) {
    lg++;
    nn >>= 1ll;
  }
  if (N == 0) lg = 1;
  int64_t ans = 0;
  for (int64_t i = l; i <= r; i++) ans += query(i, lg, N);
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  read();
  solve();
  return 0;
}
