#include <bits/stdc++.h>
using namespace std;
int const INF = numeric_limits<int>::max();
long long get_len(long long a) {
  if (a == 0 || a == 1) {
    return 1;
  } else if (a == 2) {
    return 3;
  } else {
    long long deg = log2(a);
    if (pow(2, deg) <= a) {
      deg++;
    }
    return pow(2, deg) - 1;
  }
}
long long f(long long n, long long l, long long r, long long left,
            long long right) {
  if (r < left) {
    return 0;
  }
  if (l > right) {
    return 0;
  }
  if (l == left && r == right && n < 2) {
    return n;
  }
  long long n2 = n / 2;
  long long n2len = get_len(n2);
  if (n > 1) {
    long long lsum =
        f(n2, max(l, left), min(r, left + n2len - 1), left, left + n2len - 1);
    long long msum = f(n % 2, max(left + n2len, l), min(left + n2len, r),
                       left + n2len, left + n2len);
    long long rsum = f(n2, max(l, right - n2len + 1), min(r, right),
                       right - n2len + 1, right);
    return lsum + msum + rsum;
  }
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  long long n, l, r;
  cin >> n >> l >> r;
  cout << f(n, l, r, 1, get_len(n)) << endl;
  return 0;
}
