#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long t, x, y;
  scanf("%d%lld%*d", &n, &t);
  priority_queue<long long> Q;
  vector<pair<long long, long long> > b;
  for (int i = 1; i < n; ++i) {
    scanf("%lld%lld", &x, &y);
    if (x > t) {
      Q.push(-(y - x + 1));
    } else if (x) {
      b.push_back({-x, y - x + 1});
    }
  }
  b.push_back({0, 0});
  sort(b.begin(), b.end());
  long long rest = t + b[0].first;
  while (!Q.empty() && -Q.top() <= rest) {
    rest += Q.top();
    Q.pop();
  }
  int ans = Q.size() + 1, p = 0;
  while (p < b.size() - 1) {
    int q = p;
    Q.push(-b[p].second);
    while (b[q + 1].first == b[p].first) {
      Q.push(-b[++q].second);
    }
    rest += -b[p].first + b[q + 1].first;
    while (!Q.empty() && -Q.top() <= rest) {
      rest += Q.top();
      Q.pop();
    }
    ans = min(ans, (int)Q.size() + 1);
    p = q + 1;
  }
  printf("%d\n", ans);
  return 0;
}
