#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> t[300005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%lld %lld", &t[i].first, &t[i].second);
  }
  sort(t + 1, t + n);
  multiset<long long> active;
  int ret = n;
  int curr = n - 1;
  bool changed = true;
  while (changed) {
    changed = false;
    while (curr >= 1 and t[curr].first > t[0].first) {
      active.insert(t[curr].second - t[curr].first + 1);
      --curr;
      changed = true;
    }
    ret = min(ret, (int)active.size() + 1);
    if (!active.empty() and *active.begin() <= t[0].first) {
      t[0].first -= *active.begin();
      active.erase(active.begin());
      changed = true;
    }
  }
  printf("%d", ret);
}
