#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
const int oo = 0x3f3f3f3f;
inline long long up(const long long &first) {
  if (!first) return 0;
  return (1LL << (64 - __builtin_clzll(first))) - 1;
}
inline long long cnt(const long long &n, const long long &lim) {
  if (!lim) return 0;
  long long half = n >> 1;
  long long le = up(half);
  if (lim <= le) return cnt(half, lim);
  return half + (n & 1) + cnt(half, lim - le - 1);
}
int main() {
  long long n, l, r;
  cin >> n >> l >> r;
  cout << cnt(n, r) - cnt(n, l - 1) << endl;
}
