#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  pair<long long, long long> p[n];
  for (int i = 0; i < n; i++) cin >> p[i].first >> p[i].second;
  long long left = p[0].first;
  vector<pair<long long, long long> > vec;
  multiset<long long> s;
  for (int i = 1; i < n; i++) {
    if (p[i].first > left) {
      s.insert(p[i].second - p[i].first);
    } else
      vec.push_back(make_pair(p[i].first, p[i].second));
  }
  sort(vec.begin(), vec.end());
  int pos = s.size() + 1;
  int j = vec.size() - 1;
  while (left > 0 && pos > 1) {
    left -= (*(s.begin()) + 1);
    s.erase(s.begin());
    if (left < 0) break;
    while (j >= 0 && vec[j].first > left) {
      s.insert(vec[j].second - vec[j].first);
      j--;
    }
    pos = min(pos, (int)(s.size() + 1));
  }
  cout << pos;
}
