#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(false);
  long long int n, l, r;
  cin >> n >> l >> r;
  if (n == 0) {
    cout << 0 << endl;
    return 0;
  } else if (n == 1) {
    cout << 1 << endl;
    return 0;
  } else if (n == 2) {
    vector<long long int> a;
    a.push_back(1), a.push_back(0), a.push_back(1);
    int i;
    int c = 0;
    for (i = l - 1; i < r; i++) {
      if (a[i] == 1) c++;
    }
    cout << c << endl;
    return 0;
  } else if (n == 3) {
    vector<long long int> a;
    a.push_back(1), a.push_back(1), a.push_back(1);
    int i;
    int c = 0;
    for (i = l - 1; i < r; i++) {
      if (a[i] == 1) c++;
    }
    cout << c << endl;
    return 0;
  }
  long long int t = n;
  long long int ct = 1;
  while (t != 3 && t != 2) {
    ct++;
    t = t / 2;
  }
  long long int tt = n;
  long long int ans3 = 0;
  while (tt > 3) {
    long long int kk = 0;
    long long int vv = 0;
    long long int ll, rr;
    vv = pow(2, ct);
    ll = l - vv - 1;
    if (ll >= 0) {
      ll = ll / pow(2, ct + 1) + 1;
    }
    rr = r - vv + 1;
    if (rr >= 0) {
      rr = rr / pow(2, ct + 1) + 1;
    }
    if (ll < 0) ll = 0;
    if ((rr >= 0 && ll >= 0) && (tt & 1)) {
      ans3 += rr - ll;
    }
    kk++;
    ct--;
    tt = tt / 2;
  }
  if (t == 2) {
    long long int ans;
    long long int left = 0;
    long long int right = 0;
    left = 2 * ((l - 1) / 4);
    if ((l - 1) % 4 == 1 || ((l - 1) % 4) == 2)
      left++;
    else if ((l - 1) % 4 == 3)
      left += 2;
    right = 2 * (r / 4);
    if ((r % 4) == 1 || (r % 4) == 2)
      right++;
    else if ((r % 4) == 3)
      right += 2;
    ans = right - left;
    t = 2 * t + t % 2;
    cout << ans + ans3 << endl;
  } else if (t == 3) {
    long long int ans;
    long long int left = 0;
    long long int right = 0;
    left = 3 * ((l - 1) / 4);
    left += (l - 1) % 4;
    right = 3 * (r / 4);
    right += r % 4;
    ans = right - left;
    cout << ans + ans3 << endl;
  }
}
