#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<int, int> p1, pair<int, int> p2) {
  if ((p1.second - p1.first) == (p2.second - p2.first))
    return p1.first > p2.first;
  return (p1.second - p1.first) > (p2.second - p2.first);
}
int main() {
  ios::sync_with_stdio(false);
  priority_queue<long long, vector<long long>, greater<long long> > s;
  vector<pair<long long, long long> > smaller;
  int n;
  cin >> n;
  int rank = 100000000;
  long long t, w, t1;
  for (int i = 1; i <= n; i++) {
    cin >> t >> w;
    if (i == 1) {
      t1 = t;
    } else {
      if (t > t1) {
        rank++;
        s.push(w - t + 1);
      } else {
        smaller.push_back(make_pair(t, w));
      }
    }
  }
  sort(smaller.begin(), smaller.end());
  while (1) {
    int x = s.size();
    rank = min(rank, x + 1);
    if (s.empty()) break;
    long long u = s.top();
    if (u > t1) break;
    t1 -= u;
    s.pop();
    while (!smaller.empty()) {
      pair<long long, long long> v = smaller[smaller.size() - 1];
      if (v.first <= t1) break;
      s.push(v.second - v.first + 1);
      smaller.pop_back();
    }
  }
  cout << rank << endl;
  return 0;
}
