#include <bits/stdc++.h>
using namespace std;
int n, m;
long long t[400000], w[400000];
multiset<long long> need;
multiset<pair<long long, long long> > team;
int fly = 0;
void update() {
  while (team.size() && team.rbegin()->first > t[0]) {
    pair<long long, long long> tmp = *team.rbegin();
    need.insert(tmp.second - tmp.first + 1);
    team.erase(team.find(tmp));
  }
}
int give() {
  if (need.size() && t[0] >= *need.begin()) {
    long long tmp = *need.begin();
    t[0] -= tmp;
    need.erase(need.find(tmp));
    return 1;
  }
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = (0); i < (n); i++) cin >> t[i] >> w[i];
  for (int i = (1); i < (n); i++)
    team.insert(pair<long long, long long>(t[i], w[i]));
  size_t ans = n;
  do {
    update();
    ans = min(ans, need.size() + 1);
  } while (give());
  cout << ans << '\n';
  return 0;
}
