#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300000 + 10;
const int INF = (int)(1e9);
const int MOD = (int)(1e9) + 7;
pair<long long, long long> a[MAXN];
int n;
void run() {
  scanf("%d\n", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d %I64d\n", &a[i].first, &a[i].second);
  }
  sort(a + 2, a + n + 1);
  int curr = 1;
  for (int i = 1; i <= n; i++) curr += (a[i].first > a[1].first);
  int res = curr;
  int i = n;
  priority_queue<long long, vector<long long>, greater<long long>> p;
  int l = 0;
  while (i > 1) {
    while ((i > 1) && (a[i].first > a[1].first)) {
      p.push(a[i].second - a[i].first + 1);
      l++;
      i--;
    }
    res = min(res, l + 1);
    if (p.empty()) break;
    long long x = p.top();
    p.pop();
    if (a[1].first >= x) {
      a[1].first -= x;
      l--;
    } else {
      break;
    }
  }
  while (!p.empty()) {
    long long x = p.top();
    p.pop();
    if (a[1].first >= x) {
      a[1].first -= x;
      l--;
    } else
      break;
  }
  res = min(res, l + 1);
  cout << res << endl;
}
int main() {
  int ntests = 1;
  for (int tc = 1; tc <= ntests; tc++) {
    run();
  }
}
