#include <bits/stdc++.h>
using namespace std;
template <typename Type>
void print_array(Type* array, int start, int end);
template <typename Type>
void print_vector(vector<Type> v);
int n;
long long t[300100], w[300100];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = (0), _b = (n); i < _b; i++) {
    cin >> t[i] >> w[i];
  }
  vector<pair<long long, long long> > opps;
  for (int i = (1), _b = (n); i < _b; i++) {
    opps.push_back(pair<long long, long long>(t[i], w[i]));
  }
  sort((opps).begin(), (opps).end(), greater<pair<long long, long long> >());
  int ptr = n - 1;
  for (int i = (0), _b = ((int)(opps).size()); i < _b; i++) {
    if (opps[i].first <= t[0]) {
      ptr = i;
      break;
    }
  }
  priority_queue<pair<long long, long long>,
                 vector<pair<long long, long long> >,
                 greater<pair<long long, long long> > >
      pq;
  for (int i = 0; i < opps.size(); i++) {
    pair<long long, long long> p = opps[i];
    if (p.first > t[0]) {
      pq.push(pair<long long, long long>(p.second - p.first + 1ll, i));
    }
  }
  int rank = (int)(pq).size() + 1;
  long long bal = t[0];
  while (pq.size() && bal) {
    pair<long long, long long> f = pq.top();
    if (f.first > bal) {
      break;
    } else {
      pq.pop();
      bal -= f.first;
      while (ptr < opps.size() && opps[ptr].first > bal) {
        pq.push(pair<long long, long long>(
            opps[ptr].second - opps[ptr].first + 1ll, ptr));
        ptr++;
      }
      rank = min(rank, (int)(pq).size() + 1);
    }
  }
  cout << rank << endl;
  return 0;
}
template <typename Type>
void print_array(Type* array, int start, int end) {
  cout << "[";
  for (int i = (start), _b = (end); i < _b; i++) {
    cout << array[i] << " ";
  }
  cout << "]\n";
}
template <typename Type>
void print_vector(vector<Type> v) {
  cout << "[";
  for (int i = (0), _b = ((int)(v).size()); i < _b; i++) {
    cout << v[i] << " ";
  }
  cout << "]\n";
}
