#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
long long a, b;
long long aux(long long x) {
  if (x < 2) return 0;
  return (1ll << ((long long)log2(x) + 1)) - 1;
}
long long solve(long long n, long long l, long long r) {
  if (l > b or r < a) return 0;
  long long x = l + ((r - l + 2) >> 1) - 1;
  long long tmp = (x >= a && x <= b ? n & 1 : 0);
  return tmp + (n > 1 ? solve(n / 2, l, x - 1) + solve(n / 2, x + 1, r) : 0);
}
int main() {
  ios_base::sync_with_stdio(false);
  long long n;
  cin >> n >> a >> b;
  if (n < 2) {
    cout << n << '\n';
    return 0;
  }
  cout << solve(n, 1, aux(n)) << '\n';
  return 0;
}
