#include <bits/stdc++.h>
using namespace std;
struct Team {
  long long balls, weight;
};
priority_queue<long long> A;
vector<Team> B;
bool compareBalls(const Team& first, const Team& second) {
  return first.balls < second.balls;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  long long nn, ourBalls, ourWeight;
  cin >> nn >> ourBalls >> ourWeight;
  vector<Team> teams;
  Team newTeam;
  long long Asize = 0;
  long long Bsize = 0;
  for (long long i = 1; i < nn; ++i) {
    cin >> newTeam.balls >> newTeam.weight;
    if (newTeam.balls > ourBalls) {
      A.push(newTeam.balls - newTeam.weight);
      Asize++;
    } else {
      B.push_back(newTeam);
      Bsize++;
    }
  }
  sort(B.begin(), B.end(), compareBalls);
  long long ans = Asize + 1;
  while (ourBalls != 0 && ans > 1) {
    long long canDo = -A.top() + 1;
    if (canDo > ourBalls) break;
    ourBalls -= canDo;
    A.pop();
    Asize--;
    while (Bsize != 0 && B[Bsize - 1].balls > ourBalls) {
      A.push(B[Bsize - 1].balls - B[Bsize - 1].weight);
      Bsize--;
      Asize++;
    }
    if (Asize + 1 < ans) ans = Asize + 1;
  }
  cout << ans << "\n";
  return 0;
}
