#include <bits/stdc++.h>
using namespace std;
const int mx = 300005;
int n;
long long rk = mx;
long long t[mx], w[mx], cha[mx], vis[mx];
struct node {
  long long cha;
  int id;
  bool operator<(const node &p) const { return p.cha < cha; }
} tt;
priority_queue<node> heap;
struct nd {
  long long t, cha;
};
nd cz[mx];
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + ch - 48;
    ch = getchar();
  }
  return x * f;
}
inline void check(long long sy) {
  int res = 1;
  for (register int i = 2; i <= n; ++i)
    if (!vis[i]) {
      if (sy < t[i]) ++res;
    }
  if (res < rk) rk = res;
}
void dfs(int now, long long sy) {
  if (now > n) {
    check(sy);
    return;
  }
  dfs(now + 1, sy);
  if (sy >= cha[now]) {
    vis[now] = 1;
    dfs(now + 1, sy - cha[now]);
  }
  vis[now] = 0;
}
inline bool cmp(nd a, nd b) { return a.t > b.t; }
int main() {
  n = read();
  for (register int i = 1; i <= n; ++i)
    t[i] = read(), w[i] = read(), cha[i] = w[i] - t[i] + 1;
  if (n <= 20) {
    dfs(2, t[1]);
    printf("%d", rk);
    return 0;
  }
  for (register int i = 2; i <= n; ++i)
    cz[i - 1].t = t[i], cz[i - 1].cha = cha[i];
  sort(cz + 1, cz + n, cmp);
  long long nk = 1, sy = t[1], zz, nc;
  for (register int i = 1; i < n; ++i) {
    if (cz[i].t > sy) {
      tt.id = i;
      tt.cha = cz[i].cha;
      heap.push(tt);
      ++nk;
    } else {
      zz = i;
      break;
    }
  }
  rk = nk;
  while (!heap.empty()) {
    nc = heap.top().cha;
    heap.pop();
    if (nc > sy) break;
    sy -= nc;
    --nk;
    if (zz <= n)
      for (register int i = zz; i <= n; ++i) {
        if (cz[i].t > sy) {
          tt.id = i;
          tt.cha = cz[i].cha;
          heap.push(tt);
          ++nk;
        } else {
          zz = i;
          break;
        }
      }
    if (nk < rk) rk = nk;
  }
  printf("%lld", rk);
  return 0;
}
