#include <bits/stdc++.h>
using namespace std;
long long int len = 0, k = 0, a[100005], p, q;
void findlength(long long int n, long long int mul) {
  if (n < 2) return;
  if (n % 2 == 0) {
    len += mul;
  }
  findlength(n / 2, 2 * mul);
}
void findans(long long int n, long long int l, long long int r) {
  if (n < 2) return;
  if (n % 2 == 0) {
    a[k] = (l + r) / 2;
    k++;
  }
  if (p > (l + r) / 2 - 1 || q < l) {
  } else
    findans(n / 2, l, (l + r) / 2 - 1);
  if (p > r || q < (l + r) / 2 + 1) {
  } else
    findans(n / 2, (l + r) / 2 + 1, r);
}
int main() {
  long long int n, l, r, i, left, right;
  cin >> n >> l >> r;
  l--;
  r--;
  p = l;
  q = r;
  findlength(n, 1);
  len += n;
  if (n == 0) len++;
  findans(n, 0, len - 1);
  sort(a, a + k);
  left = 0;
  while (left < k) {
    if (l > a[left])
      left++;
    else
      break;
  }
  if (left >= k) left--;
  right = 0;
  while (right < k) {
    if (r > a[right])
      right++;
    else
      break;
  }
  if (right >= k) right--;
  if (a[right] > r) right--;
  if (a[right] > r) right--;
  if (len == n || r < l) {
    cout << r - l + 1 << endl;
  } else {
    cout << (r - l + 1) - (right - left + 1) << endl;
  }
  return 0;
}
