#include <bits/stdc++.h>
using namespace std;
struct S {
  long long t, w;
} s[300009];
bool comp(S a, S b) { return a.t > b.t; }
int main() {
  int n;
  scanf("%d", &n);
  n--;
  long long c, tmp;
  scanf("%lld %lld", &c, &tmp);
  for (int i = 0; i < n; i++) {
    scanf("%lld %lld", &s[i].t, &s[i].w);
  }
  sort(s, s + n, comp);
  int ans = n + 1;
  int j = 0;
  multiset<long long> S;
  while (true) {
    while (j < n && s[j].t > c) {
      S.insert(s[j].w - s[j].t + 1);
      j++;
    }
    ans = min(ans, (int)S.size() + 1);
    if (S.empty() || *S.begin() > c) {
      break;
    }
    c -= *S.begin();
    S.erase(S.begin());
  }
  printf("%d", ans);
}
