#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  --n;
  vector<pair<long long, long long> > v(n);
  pair<long long, long long> limak;
  cin >> limak.first >> limak.second;
  for (int i = 0; i < n; ++i) {
    cin >> v[i].first >> v[i].second;
  }
  sort((v).begin(), (v).end());
  int l = 0;
  while (l < n && v[l].first <= limak.first) ++l;
  if (l == n) {
    cout << 1 << endl;
    return 0;
  }
  multiset<long long> s;
  for (int i = l; i < n; ++i) s.insert(v[i].second - v[i].first + 1);
  l--;
  int best = 0x3f3f3f3f;
  while (1) {
    best = min(best, (int)s.size() + 1);
    if (s.empty()) break;
    long long cur = *s.begin();
    s.erase(s.begin());
    if (limak.first - cur < 0) break;
    limak.first -= cur;
    while (l >= 0 && v[l].first > limak.first)
      s.insert(v[l].second - v[l--].first + 1);
  }
  cout << best << endl;
}
