#include <bits/stdc++.h>
using namespace std;
long long int lt, lw;
int n, ans, out;
vector<pair<long long int, long long int> > v;
priority_queue<long long int> s;
int main() {
  scanf("%d%I64d%I64d", &n, &lt, &lw);
  for (int i = 1; i < n; i++) {
    long long int t, w;
    scanf("%I64d%I64d", &t, &w);
    if (t > lt)
      s.push(t - w), ans++;
    else
      v.push_back(make_pair(t, w));
  }
  sort(v.begin(), v.end());
  out = ans;
  while (true) {
    if (s.empty() || -s.top() >= lt) break;
    lt = lt + s.top() - 1;
    ans--;
    s.pop();
    while (v.size() && v.back().first > lt) {
      s.push(v.back().first - v.back().second);
      ans++;
      v.pop_back();
    }
    out = min(ans, out);
  }
  cout << out + 1 << endl;
  return 0;
}
