#include <bits/stdc++.h>
using namespace std;
struct node {
  long long t, w;
};
node num[350000];
long long t, w;
int n;
bool cmp(const node &a, const node &b) { return (a.t < b.t); }
long long tree[350000 * 3];
int mpos[350000 * 3];
void build(int o, int L, int R) {
  if (L == R) {
    tree[o] = num[L - 1].w - num[L - 1].t;
    mpos[o] = L;
  } else {
    int M = (L + R) / 2;
    build(o * 2, L, M);
    build(o * 2 + 1, M + 1, R);
    if (tree[o * 2] < tree[o * 2 + 1]) {
      tree[o] = tree[o * 2];
      mpos[o] = mpos[o * 2];
    } else {
      tree[o] = tree[o * 2 + 1];
      mpos[o] = mpos[o * 2 + 1];
    }
  }
}
const long long MAX = 1e18 + 10;
void chang(int o, int L, int R, int pos) {
  if (o == 0) return;
  if (L == R && L == pos) {
    tree[o] = MAX;
  } else {
    int M = (L + R) / 2;
    if (M >= pos)
      chang(o * 2, L, M, pos);
    else
      chang(o * 2 + 1, M + 1, R, pos);
    if (tree[o * 2] < tree[o * 2 + 1]) {
      tree[o] = tree[o * 2];
      mpos[o] = mpos[o * 2];
    } else {
      tree[o] = tree[o * 2 + 1];
      mpos[o] = mpos[o * 2 + 1];
    }
  }
}
node query(int o, int L, int R, int l, int r) {
  if (l <= L && r >= R) {
    node ppp;
    ppp.t = mpos[o];
    ppp.w = tree[o];
    return ppp;
  } else {
    int M = (L + R) / 2;
    node ans;
    if (l <= M) {
      ans = query(o * 2, L, M, l, r);
    }
    if (r > M) {
      if (l > M)
        ans = query(o * 2 + 1, M + 1, R, l, r);
      else {
        node ppp = query(o * 2 + 1, M + 1, R, l, r);
        if (ppp.w <= ans.w) ans = ppp;
      }
    }
    return ans;
  }
}
int main() {
  while (~scanf("%d", &n)) {
    scanf("%I64d%I64d", &t, &w);
    for (int i = 1; i < n; i++)
      scanf("%I64d%I64d", &num[i - 1].t, &num[i - 1].w);
    n--;
    sort(num, num + n, cmp);
    int pm = 0, pos;
    for (int i = n; i >= 1; i--) {
      if (num[i - 1].t > t)
        pm++;
      else
        break;
    }
    pos = n - pm;
    build(1, 1, n);
    if (pm == 0)
      printf("%d\n", pm + 1);
    else {
      int ans = pm;
      while (t) {
        long long flyid = query(1, 1, n, pos + 1, n).t;
        long long cost = num[flyid - 1].w - num[flyid - 1].t + 1;
        long long newt = t - cost;
        int newpm = pm - 1;
        int newpos = pos;
        if (newt < 0) break;
        for (int i = pos; i >= 1; i--) {
          if (num[i - 1].t > newt)
            newpm++, newpos--;
          else
            break;
        }
        t = newt;
        pm = newpm;
        pos = newpos--;
        chang(1, 1, n, flyid);
        ans = min(ans, pm);
        if (ans == 0) break;
      }
      printf("%d\n", ans + 1);
    }
  }
  return 0;
}
