#include <bits/stdc++.h>
using namespace std;
struct thing {
  long long i, j;
  thing() {}
  thing(long long a, long long b) {
    i = a;
    j = b;
  }
} p[300005];
struct camp1 {
  bool operator()(const thing a, const thing b) {
    return a.j - a.i < b.j - b.i;
  }
};
struct camp2 {
  bool operator()(const thing a, const thing b) { return a.i < b.i; }
};
multiset<thing, camp1> f1;
multiset<thing, camp2> f2;
int n;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d%I64d", &p[i].i, &p[i].j);
    if (i == 1) continue;
    if (p[i].i > p[1].i)
      f1.insert(p[i]);
    else
      f2.insert(p[i]);
  }
  int rank = f1.size() + 1;
  int now = rank;
  thing temp = p[1];
  while (rank != 1) {
    thing fir = *f1.begin();
    if ((fir.j - fir.i + 1) > temp.i) break;
    temp.i -= fir.j - fir.i + 1;
    f1.erase(f1.begin());
    now--;
    while (true) {
      auto tem = f2.lower_bound(thing(temp.i + 1, 0));
      if (tem == f2.end()) break;
      f1.insert(*tem);
      now++;
      f2.erase(tem);
    }
    rank = min(rank, now);
  }
  cout << rank << endl;
}
