#include <bits/stdc++.h>
using namespace std;
const long double epsylon = 1e-9;
const std::string PROGRAM_NAME = "ivo";
int main() {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  long long w, t;
  cin >> t >> w;
  priority_queue<long long> pq;
  vector<pair<long long, long long> > competition;
  for (int i = 0; i < n - 1; ++i) {
    long long tt, tw;
    cin >> tt >> tw;
    if (tt > t) {
      pq.push(tt - tw - 1LL);
    } else {
      competition.push_back(make_pair(tt, tw));
    }
  }
  int best = pq.size() + 1;
  sort(competition.begin(), competition.end());
  reverse(competition.begin(), competition.end());
  int ix = 0;
  while (t >= 0 && !pq.empty()) {
    long long needed = -pq.top();
    if (needed > t) {
      break;
    }
    t -= needed;
    pq.pop();
    while (ix < (int)competition.size() && competition[ix].first > t) {
      pq.push(competition[ix].first - competition[ix].second - 1LL);
      ix++;
    }
    int cur = pq.size() + 1;
    if (cur < best) {
      best = cur;
    }
  }
  cout << best << endl;
  return 0;
}
