#include <bits/stdc++.h>
using namespace std;
template <class T>
bool remin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool remax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int nxt() {
  int first;
  scanf("%" PRId32, &first);
  return first;
}
long long nxtll() {
  long long first;
  scanf("%" PRId64, &first);
  return first;
}
long long gcd(long long a, long long b) {
  a = abs(a);
  b = abs(b);
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
struct Q {
  long long n, d;
  Q(long long a = 0) : n(a), d(1) {}
  Q(long long nn, long long dd) : n(nn), d(dd) { norm(); }
  void norm() {
    long long g = gcd(abs(n), abs(d));
    n /= g;
    d /= g;
    if (d < 0) {
      n *= -1;
      d *= -1;
    }
  }
  Q operator+(const Q &r) const { return Q(n * r.d + d * r.n, d * r.d); }
  Q operator-(const Q &r) const { return Q(n * r.d - d * r.n, d * r.d); }
  Q operator*(const Q &r) const { return Q(n * r.n, d * r.d); }
  Q operator/(const Q &r) const { return Q(n * r.d, d * r.n); }
  long long value(const Q &r) const { return n * r.d - d * r.n; }
  bool operator<(const Q &r) const { return value(r) < 0; }
  bool operator!=(const Q &r) const { return value(r) != 0; }
  bool operator>(const Q &r) const { return value(r) > 0; }
  bool operator>=(const Q &r) const { return value(r) >= 0; }
  bool operator<=(const Q &r) const { return value(r) <= 0; }
  bool operator==(const Q &r) const { return value(r) == 0; }
};
ostream &operator<<(ostream &os, const Q &p) { return os << p.n << "/" << p.d; }
struct pt {
  double first, second, z;
  pt() = default;
  pt(double first, double second, double z)
      : first(first), second(second), z(z) {}
  inline pt operator-(const pt &r) const {
    return pt(first - r.first, second - r.second, z - r.z);
  }
  inline pt operator+(const pt &r) const {
    return pt(first + r.first, second + r.second, z + r.z);
  }
  inline pt operator*(const double &r) const {
    return pt(first * r, second * r, z * r);
  }
  inline pt operator-() const { return pt(-first, -second, -z); }
  inline double sqlen() const {
    return fabsl(first * first + second * second + z * z);
  }
};
ostream &operator<<(ostream &os, const pt &p) {
  return os << "(" << p.first << "," << p.second << "," << p.z << ")";
}
inline pt cross(const pt &l, const pt &r) {
  return pt(l.second * r.z - l.z * r.second, l.z * r.first - l.first * r.z,
            l.first * r.second - l.second * r.first);
}
inline double dot(const pt &l, const pt &r) {
  return l.first * r.first + l.second * r.second + l.z * r.z;
}
long long pwmod(long long a, long long n, long long mod) {
  long long ret = 1;
  while (n) {
    if (n & 1) ret = ret * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return ret;
}
template <typename T>
inline T sqr(T first) {
  return first * first;
}
long long len(long long n) {
  if (n == 0 || n == 1) {
    return 1;
  }
  return 2 * len(n / 2) + 1;
}
long long solve(long long n, long long l, long long r) {
  if (l >= r) return 0;
  if (n <= 1) {
    assert(l == 0 && r == 1);
    return n;
  }
  long long le = len(n);
  long long l2 = le / 2;
  if (r > le) {
    assert(false);
  }
  long long ret = 0;
  if (l <= l2 && r > l2) {
    ret += n & 1ll;
  }
  ret += solve(n / 2, l, min(r, l2));
  ret += solve(n / 2, max(l - l2 - 1, 0ll), r - l2 - 1);
  return ret;
}
void solve() {
  long long n;
  cin >> n;
  long long l, r;
  cin >> l >> r;
  --l;
  cout << solve(n, l, r) << "\n";
}
void prepare() {}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  prepare();
  int t = 1;
  for (int i = 0; i < (int)(t); i++) {
    solve();
  }
  cerr << "Time " << clock() / (double)CLOCKS_PER_SEC << endl;
  return 0;
}
