#include <bits/stdc++.h>
using namespace std;
const int iinf = 1e9 + 7;
const long long LINF = 1ll << 60;
const double dinf = 1e10;
inline long long read() {
  bool f = 0;
  long long x = 0;
  char c = getchar();
  while ((c < '0' || c > '9') && c != '-') c = getchar();
  if (c == '-') {
    f = 1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  if (f) x = -x;
  return x;
}
inline void scf(int &x) {
  bool f = 0;
  x = 0;
  char c = getchar();
  while ((c < '0' || c > '9') && c != '-') c = getchar();
  if (c == '-') {
    f = 1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  if (f) x = -x;
  return;
}
void scf(int &x, int &y) {
  scf(x);
  return scf(y);
}
void scf(int &x, int &y, int &z) {
  scf(x);
  scf(y);
  return scf(z);
}
const int N = 3e5 + 100;
int n, cnt;
map<pair<long long, int>, int> M;
struct team {
  long long t, w, fly;
  int rnk, id;
  void in(int i) {
    id = i;
    t = read();
    w = read();
    fly = w - t + 1;
    return;
  }
  bool operator<(const team &a) const { return t < a.t; }
} _tm[N];
bool cmp(const team &a, const team &b) { return a.fly < b.fly; }
struct fenwick_tree {
  long long num[N];
  inline int lowbit(int i) { return i & (-i); }
  inline void modify(int i, long long x) {
    for (; i <= cnt; i += lowbit(i)) {
      if (num[i] + x >= LINF) {
        num[i] = LINF;
        break;
      }
      num[i] += x;
    }
    return;
  }
  inline long long query(int i) {
    long long ret = 0;
    for (; i; i ^= lowbit(i)) {
      if (ret + num[i] > LINF) return LINF;
      ret += num[i];
    }
    return ret;
  }
} BIT1, BIT2;
int ans = 1;
int main() {
  scf(n);
  for (int i = 0; i < (n); i++) _tm[i].in(i);
  n--;
  for (int i = (1); i <= (n); i++)
    if (_tm[i].t > _tm[0].t) ans++;
  sort(_tm + 1, _tm + 1 + n, cmp);
  for (int i = (1); i <= (n); i++) M[make_pair(_tm[i].fly, _tm[i].id)];
  for (auto it = M.begin(); it != M.end(); it++) cnt++, it->second = cnt;
  for (int i = (1); i <= (n); i++)
    _tm[i].rnk = M[make_pair(_tm[i].fly, _tm[i].id)];
  sort(_tm + 1, _tm + 1 + n);
  for (int i = (n); i >= (1); i--) {
    if (_tm[i].t <= _tm[0].t && (i == n || _tm[i].t < _tm[i + 1].t)) {
      long long lft = _tm[0].t - _tm[i].t;
      int lb = 0, rb = cnt;
      while (lb <= rb) {
        int mid = lb + rb >> 1;
        long long t = BIT2.query(mid);
        if (t <= lft)
          lb = mid + 1;
        else
          rb = mid - 1;
      }
      int calc = n - i - BIT1.query(rb) + 1;
      if (calc < ans) ans = calc;
    }
    BIT1.modify(_tm[i].rnk, 1);
    BIT2.modify(_tm[i].rnk, _tm[i].fly);
  }
  long long lft = _tm[0].t;
  int lb = 0, rb = cnt;
  while (lb <= rb) {
    int mid = lb + rb >> 1;
    long long t = BIT2.query(mid);
    if (t <= lft)
      lb = mid + 1;
    else
      rb = mid - 1;
  }
  int calc = n - BIT1.query(rb) + 1;
  if (calc < ans) ans = calc;
  printf("%d\n", ans);
  return 0;
}
