#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<pair<long long int, long long int> > v(n - 1);
  pair<long long int, long long int> limak;
  long long int t, w;
  cin >> t >> w;
  limak = make_pair(t, w);
  for (int i = 0; i < n - 1; ++i) {
    cin >> t >> w;
    v[i] = make_pair(t, w);
  }
  sort(v.begin(), v.end(),
       [](const pair<long long int, long long int> &a,
          const pair<long long int, long long int> &b) { return b < a; });
  map<long long int, long long int> m;
  auto it = v.begin();
  int bestPlace = 1;
  while (it != v.end()) {
    if (it->first > limak.first) {
      m[it->second - it->first]++;
      bestPlace++;
    } else {
      break;
    }
    it++;
  }
  long long int d;
  int curPlace = bestPlace;
  while (true) {
    if (m.size() == 0 || limak.first == 0) {
      break;
    }
    d = m.begin()->first + 1;
    if (limak.first >= d) {
      limak.first -= d;
      curPlace--;
    } else {
      break;
    }
    m.begin()->second--;
    if (m.begin()->second == 0) {
      m.erase(m.begin());
    }
    while (it != v.end()) {
      if (it->first > limak.first) {
        m[it->second - it->first]++;
        curPlace++;
      } else {
        break;
      }
      it++;
    }
    if (curPlace < bestPlace) {
      bestPlace = curPlace;
    }
  }
  cout << min(curPlace, bestPlace) << endl;
  return 0;
}
