#include <bits/stdc++.h>
using namespace std;
const int mm = 2e5 + 100;
long long int d[mm], ans[mm];
long long int low(long long int x) {
  if (x <= 1)
    return 1;
  else
    return low(x / 2) * 2 + 1;
}
long long int dfs(long long int n, long long int l, long long int r,
                  long long int x, long long int y) {
  if (x > r || y < l) return 0;
  if (n == 1)
    return 1;
  else if (n == 0)
    return 0;
  long long int mid = x + low(n / 2);
  return dfs(n / 2, l, r, x, mid - 1) + dfs(n % 2, l, r, mid, mid) +
         dfs(n / 2, l, r, mid + 1, y);
}
int main() {
  long long int n, m, i, j, t, a, b, c, p, k, kk;
  scanf("%lld%lld%lld", &n, &a, &b);
  long long int sum = low(n);
  printf("%lld\n", dfs(n, a, b, 1, sum));
}
