#include <bits/stdc++.h>
using namespace std;
long long N;
long long T[300000], W[300000];
vector<pair<long long, long long> > lowidx;
long long check() {
  priority_queue<long long, vector<long long>, greater<long long> > highdist;
  for (long long i = 1; i < N; i++) {
    if (T[0] < T[i]) highdist.push(W[i] - T[i] + 1);
  }
  long long ret = highdist.size() + 1, tail = 0;
  long long odd = T[0];
  while (!highdist.empty()) {
    long long val = highdist.top();
    highdist.pop();
    odd -= val;
    if (odd < 0) return (ret);
    while (tail < lowidx.size() && odd < lowidx[tail].first) {
      highdist.push(lowidx[tail].second);
      ++tail;
    }
    ret = min<long long>(ret, highdist.size() + 1);
  }
  return (ret);
}
signed main() {
  scanf("%lld", &N);
  for (long long i = 0; i < N; i++) {
    scanf("%lld %lld", &T[i], &W[i]);
  }
  for (long long i = 1; i < N; i++) {
    if (T[0] >= T[i]) lowidx.emplace_back(T[i], W[i] - T[i] + 1);
  }
  sort(begin(lowidx), end(lowidx));
  reverse(begin(lowidx), end(lowidx));
  printf("%lld\n", check());
}
