#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("O3")
#pragma GCC optimize("fast-math")
using namespace std;
const int INF = 1e9;
const long long INFll = 2e18;
const int BASE1 = 179;
const int BASE2 = 653;
const long long MOD = 1e9 + 7;
const int MAXN = 2e5;
const long double PI = 3.1415926535;
const long double EPS = 1e-15;
void solve() {
  long long n;
  cin >> n;
  vector<long long> t(n), w(n);
  for (int i = 0; i < (n); i++) cin >> t[i] >> w[i];
  multiset<long long> great;
  multiset<pair<long long, long long>, greater<pair<long long, long long>>> a;
  for (int i = 1; i < n; i++) {
    if (t[i] > t[0])
      great.insert(w[i] - t[i] + 1);
    else
      a.insert(make_pair(t[i], i));
  }
  long long res = ((int)(great).size());
  while (!great.empty()) {
    long long cnt = *great.begin();
    great.erase(great.begin());
    if (t[0] < cnt) break;
    t[0] -= cnt;
    while (!a.empty() && (*a.begin()).first > t[0]) {
      auto d = (*a.begin());
      a.erase(a.begin());
      great.insert(w[d.second] - d.first + 1);
    }
    res = min(res, (long long)((int)(great).size()));
  }
  cout << res + 1 << "\n";
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << setprecision(14) << fixed;
  int t = 1;
  while (t--) solve();
  return 0;
}
