#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e6 + 5;
multiset<long long> ranks;
pair<long long, long long> num[maxn];
bool cmp(pair<long long, long long> a, pair<long long, long long> b) {
  return a.first > b.first;
}
int main() {
  int n;
  scanf("%d", &n);
  long long s, e;
  int cnt = 0;
  scanf("%I64d%I64d", &s, &e);
  for (int i = 0; i < n - 1; i++) {
    long long x, y;
    scanf("%I64d%I64d", &x, &y);
    num[cnt].first = x;
    num[cnt].second = y;
    cnt++;
  }
  sort(num, num + cnt, cmp);
  int ans = maxn, i = 0;
  while (1) {
    while (num[i].first > s && i < cnt) {
      ranks.insert(num[i].second - num[i].first + 1);
      i++;
    }
    int tt = ranks.size();
    if (tt < ans) ans = tt;
    if (tt == 0) break;
    if (tt > 0) {
      long long it = *ranks.begin();
      if (it > s)
        break;
      else {
        ranks.erase(ranks.begin());
        s -= it;
      }
    }
  }
  if (ans == maxn) ans = 0;
  printf("%d\n", ans + 1);
}
