#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 1e15;
const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, -1, 1, -1, 1};
const int maxn = 1e3 + 10;
const int maxx = 1e6 + 10;
const double EPS = 1e-10;
const double eps = 1e-10;
template <class T>
inline T min(T a, T b, T c) {
  return min(min(a, b), c);
}
template <class T>
inline T max(T a, T b, T c) {
  return max(max(a, b), c);
}
template <class T>
inline T min(T a, T b, T c, T d) {
  return min(min(a, b), min(c, d));
}
template <class T>
inline T max(T a, T b, T c, T d) {
  return max(max(a, b), max(c, d));
}
template <class T>
inline bool scan_d(T &ret) {
  char c;
  int sgn;
  if (c = getchar(), c == EOF) {
    return 0;
  }
  while (c != '-' && (c < '0' || c > '9')) {
    c = getchar();
  }
  sgn = (c == '-') ? -1 : 1;
  ret = (c == '-') ? 0 : (c - '0');
  while (c = getchar(), c >= '0' && c <= '9') {
    ret = ret * 10 + (c - '0');
  }
  ret *= sgn;
  return 1;
}
inline bool scan_lf(double &num) {
  char in;
  double Dec = 0.1;
  bool IsN = false, IsD = false;
  in = getchar();
  if (in == EOF) return false;
  while (in != '-' && in != '.' && (in < '0' || in > '9')) in = getchar();
  if (in == '-') {
    IsN = true;
    num = 0;
  } else if (in == '.') {
    IsD = true;
    num = 0;
  } else
    num = in - '0';
  if (!IsD) {
    while (in = getchar(), in >= '0' && in <= '9') {
      num *= 10;
      num += in - '0';
    }
  }
  if (in != '.') {
    if (IsN) num = -num;
    return true;
  } else {
    while (in = getchar(), in >= '0' && in <= '9') {
      num += Dec * (in - '0');
      Dec *= 0.1;
    }
  }
  if (IsN) num = -num;
  return true;
}
void Out(long long a) {
  if (a < 0) {
    putchar('-');
    a = -a;
  }
  if (a >= 10) Out(a / 10);
  putchar(a % 10 + '0');
}
void print(long long a) { Out(a), puts(""); }
long long n, l, r;
long long query(long long l1, long long r1, long long l, long long r,
                long long x) {
  if (l1 == r1) return x;
  long long mid = (l1 + r1) >> 1;
  long long a = 0, b = 0, c = 0;
  if (l < mid) a = query(l1, mid - 1, l, r, x >> 1);
  if (r > mid) b = query(mid + 1, r1, l, r, x >> 1);
  if (l <= mid && r >= mid) c = x % 2;
  return a + b + c;
}
void solve() {
  while (scanf("%I64d%I64d%I64d", &n, &l, &r) != EOF) {
    long long len = 1;
    long long now = n;
    long long add = 2;
    while (now > 1) {
      now >>= 1;
      len += add;
      add <<= 1;
    }
    print(query(1, len, l, r, n));
  }
}
int main() {
  int t = 1;
  for (int cas = 1; cas <= t; cas++) {
    solve();
  }
}
