#include <bits/stdc++.h>
using namespace std;
long long n;
long long cur_val;
pair<pair<long long, long long>, long long> arr[300001];
multiset<long long> CurrList;
long long cnt = 0;
long long res = 1e9;
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    long long x, y;
    cin >> arr[i].first.first >> arr[i].first.second;
    arr[i].second = i;
    if (i == 1) cur_val = arr[i].first.first;
  }
  sort(arr + 1, arr + 1 + n);
  long long pos = n;
  while (1) {
    while (arr[pos].first.first > cur_val) {
      if (arr[pos].second != 1)
        CurrList.insert(arr[pos].first.second - arr[pos].first.first + 1);
      pos--;
    }
    res = min(res, (long long)CurrList.size() + 1);
    if (!CurrList.empty()) {
      multiset<long long>::iterator it = CurrList.begin();
      cur_val -= (*it);
      CurrList.erase(CurrList.begin());
      if (cur_val < 0) break;
    } else
      break;
  }
  cout << res;
}
