#include <bits/stdc++.h>
using namespace std;
int n;
pair<long long, long long> t[300100];
long long w[300100];
int main() {
  cin >> n;
  multiset<unsigned long long> st1;
  multiset<unsigned long long>::iterator it;
  long long mw, mt;
  cin >> mt >> mw;
  for (int i = 1; i < n; i++) {
    scanf("%I64d%I64d", &t[i].first, &t[i].second);
    t[i].second = t[i].second - t[i].first + 1;
  }
  sort(t + 1, t + n);
  reverse(t + 1, t + n);
  int st = 1;
  int minn = 1e18;
  while (1) {
    while (st < n && mt < t[st].first) {
      st1.insert(t[st].second);
      pair<long long, long long> h = t[st];
      st++;
    }
    minn = min(minn, (int)st1.size() + 1);
    if (st1.empty()) {
      break;
    }
    it = st1.begin();
    if (*it > mt) {
      break;
    }
    mt -= *it;
    st1.erase(it);
  }
  cout << minn << endl;
  return 0;
}
