#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int INF = 1e9;
const double EPS = 1e-8;
const int MAXN = 4e5;
struct node {
  long long t, w;
};
int n, ans;
node a[MAXN];
priority_queue<long long> qb;
priority_queue<pair<long long, long long> > qa;
int main() {
  scanf("%d", &(n));
  long long myt, myw;
  scanf("%lld%lld", &myt, &myw);
  for (int i = 2; i <= n; i++) {
    scanf("%I64d%I64d", &a[i].t, &a[i].w);
    if (a[i].t > myt)
      qb.push(a[i].t - a[i].w);
    else
      qa.push(make_pair(a[i].t, a[i].w));
  }
  ans = qb.size();
  while (!qb.empty() && myt > -qb.top()) {
    myt -= (-qb.top() + 1);
    qb.pop();
    while (!qa.empty() && qa.top().first > myt) {
      qb.push(qa.top().first - qa.top().second);
      qa.pop();
    }
    int temp = qb.size();
    ans = min(ans, temp);
  }
  printf("%d\n", ans + 1);
  return 0;
}
