#include <bits/stdc++.h>
using namespace std;
long long n, ptr = -1, result;
vector<pair<long long, long long>> v;
long long ti, wi;
class comp {
 public:
  bool operator()(const long long &x, const long long &y) { return x > y; }
};
priority_queue<long long, vector<long long>, comp> pq;
void read() {
  cin >> n;
  cin >> ti >> wi;
  for (int i = 1; i <= n - 1; i++) {
    long long t, w;
    cin >> t >> w;
    v.push_back(make_pair(t, w));
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) {
    if (ti < v[i].first) {
      pq.push(v[i].second - v[i].first + 1LL);
      ptr = i;
    }
  }
  if (ptr == -1) {
    cout << "1" << endl;
    return;
  }
  result = 1000000;
  while (!pq.empty()) {
    if (result > pq.size()) {
      result = pq.size();
    }
    long long to = pq.top();
    if (ti >= to) {
      ti -= to;
      pq.pop();
      for (int i = ptr + 1; i < v.size() && v[i].first > ti; i++) {
        pq.push(v[i].second - v[i].first + 1LL);
        ptr = i;
      }
    } else {
      break;
    }
  }
  if (pq.empty()) {
    result = 0;
  }
  cout << result + 1 << endl;
}
int main() {
  read();
  return 0;
}
