#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> tw[300003];
int main() {
  int n, rnk = 1, ans;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld%lld", &tw[i].first, &tw[i].second);
    if (tw[i].first > tw[0].first) rnk++;
  }
  ans = rnk;
  auto cmp = [](const pair<long long, long long>& a,
                const pair<long long, long long>& b) -> bool {
    return a.second - a.first > b.second - b.first;
  };
  priority_queue<pair<long long, long long>,
                 vector<pair<long long, long long> >, decltype(cmp)>
      pq(cmp);
  sort(tw + 1, tw + n, greater<pair<long long, long long> >());
  int idx = n;
  for (int i = 1; i < n; i++) {
    if (tw[i].first > tw[0].first) {
      pq.push(tw[i]);
    } else {
      idx = i;
      break;
    }
  }
  while (!pq.empty()) {
    pair<long long, long long> t = pq.top();
    pq.pop();
    long long e = (t.second - t.first + 1LL);
    if (tw[0].first >= e) {
      tw[0].first -= e;
      rnk--;
      for (; idx < n; idx++) {
        if (tw[idx].first > tw[0].first) {
          pq.push(tw[idx]);
          rnk++;
        } else {
          break;
        }
      }
      ans = min(ans, rnk);
    } else
      break;
  }
  printf("%d", ans);
  return 0;
}
