#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long sum = 0, ff = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') ff = -1;
    ch = getchar();
  }
  while (isdigit(ch)) sum = sum * 10 + (ch ^ 48), ch = getchar();
  return sum * ff;
}
const long long N = 3e5 + 5;
long long n, m, ans = 1e9, b[N];
struct Node {
  long long x, y, id;
  inline bool friend operator<(const Node &a, const Node &b) {
    return a.x > b.x;
  }
};
Node a[N];
priority_queue<long long, vector<long long>, greater<long long> > q;
signed main() {
  n = read();
  for (long long i = 1; i <= n; i++) a[i] = (Node){read(), read(), i};
  sort(a + 2, a + n + 1);
  long long j = 2;
  while (1) {
    while (j <= n && a[j].x > a[1].x) q.push(a[j].y - a[j].x + 1), j++;
    ans = min(ans, (long long)q.size() + 1);
    if (!q.empty() && a[1].x >= q.top()) {
      a[1].x -= q.top();
      q.pop();
    } else
      return printf("%lld\n", ans), 0;
  }
  return 0;
}
