#include <bits/stdc++.h>
using namespace std;
const double pi = 3.141592653689793238460;
const long long inf = 0x3f3f3f3f3f3f;
const int N = 2e5 + 5;
const int pr = 31;
using ld = long double;
int mod = 1e9 + 7;
long long gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(int a, int b) { return (a / gcd(a, b)) * b; }
int fact(int n) {
  int res = 1;
  for (int i = 2; i <= n; i++) res = res * i % mod;
  return res % mod;
}
int ncr(int n, int r) { return fact(n) / (fact(r) * fact(n - r)); }
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (1ll * res * x) % p;
    y = y >> 1;
    x = (1ll * x * x) % p;
  }
  return res;
}
unsigned long long modInverse(unsigned long long n, int p) {
  return power(n, p - 2, p);
}
unsigned long long ncrm(unsigned long long n, int r, int p) {
  if (n < r) return 0;
  if (r == 0) return 1;
  unsigned long long fac[2043];
  fac[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = (fac[i - 1] * i) % p;
  return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) %
         p;
}
unsigned int setbit(long long n) {
  unsigned long long count = 0;
  while (n) {
    n &= (n - 1);
    count++;
  }
  return count;
}
int sub(string s1, string s2) {
  int M = s1.length();
  int N = s2.length();
  for (int i = 0; i <= N - M; i++) {
    int j;
    for (j = 0; j < M; j++)
      if (s2[i + j] != s1[j]) break;
    if (j == M) return i;
  }
  return -1;
}
bool subse(string str1, string str2) {
  int j = 0;
  for (int i = 0; i < str2.length() && j < str1.length(); i++)
    if (str1[j] == str2[i]) j++;
  return (j == str1.length());
}
unsigned P2(unsigned x) {
  x |= x >> 1;
  x |= x >> 2;
  x |= x >> 4;
  x |= x >> 8;
  x |= x >> 16;
  return x ^ (x >> 1);
}
long long phi(long long n) {
  long long result = n;
  for (long long i = 2; (long long)i * i <= n; i++) {
    if (n % i == 0) {
      while (n % i == 0) n /= i;
      result -= result / i;
    }
  }
  if (n > 1) {
    result -= result / n;
  }
  return result;
}
long long largestpower(long long n, long long p) {
  long long x = 0;
  long long curr = n;
  while (curr) {
    curr /= p;
    x += curr;
  }
  return x;
}
long long cnt(long long val) {
  long long x = 1;
  while (val > 1) {
    val /= 2;
    x *= 2;
  }
  return x;
}
int isbit(long long len, long long tt, long long num) {
  if (num < 2) return num;
  if (len + 1 == 2 * tt) {
    return num % 2;
  }
  num /= 2;
  len /= 2;
  if (tt > len + 1) {
    tt -= (len + 1);
  }
  return isbit(len, tt, num);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed << setprecision(17);
  long long n, l, r;
  cin >> n >> l >> r;
  long long cc = 0;
  long long x = cnt(n);
  x = 2 * x - 1;
  for (long long i = l; i <= r; i++) cc += isbit(x, i, n);
  cout << cc << '\n';
}
