#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int INF = 0x3f3f3f3f;
long long n, l, r;
pair<long long, long long> dfs(long long x) {
  if (x == 0)
    return make_pair(1, 0);
  else if (x == 1)
    return make_pair(1, 1);
  long long tmp = x & 1;
  pair<long long, long long> t = dfs(x / 2);
  t.first = t.first * 2 + 1;
  t.second = t.second * 2 + tmp;
  return t;
}
long long get(long long x, long long k) {
  if (x == 0)
    return 0;
  else if (x == 1)
    return 1;
  pair<long long, long long> t = dfs(x / 2);
  if (k <= t.first)
    return get(x / 2, k);
  else if (k == t.first + 1)
    return t.second + (x & 1);
  else {
    return t.second + (x & 1) + get(x / 2, k - t.first - 1);
  }
}
int main() {
  scanf("%I64d%I64d%I64d", &n, &l, &r);
  printf("%I64d\n", get(n, r) - (l - 1 == 0 ? 0 : get(n, l - 1)));
  return 0;
}
