#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n;
pair<long long, long long> a[3 * N];
multiset<long long> needs;
multiset<pair<long long, long long>> nexts;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  for (int i = 2; i <= n; i++) {
    if (a[i].first > a[1].first) {
      needs.insert(a[i].second - a[i].first + 1);
    } else {
      nexts.insert(a[i]);
    }
  }
  int ans = needs.size() + 1;
  while (true) {
    ans = min(ans, (int)needs.size() + 1);
    if (needs.size() == 0 || a[1].first == 0) {
      break;
    }
    multiset<long long>::iterator it = needs.begin();
    long long val = *it;
    if (a[1].first >= val) {
      a[1].first = a[1].first - val;
      needs.erase(it);
    } else {
      a[1].first = 0;
    }
    while (true) {
      if (nexts.size() == 0) {
        break;
      }
      multiset<pair<long long, long long>>::iterator jt = nexts.end();
      jt--;
      long long val = (*jt).first;
      long long wgth = (*jt).second;
      if (val > a[1].first) {
        needs.insert(wgth - val + 1);
        nexts.erase(jt);
      } else {
        break;
      }
    }
  }
  cout << ans;
}
