#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long dx[] = {-1, 0, 1, 0};
long long dy[] = {0, -1, 0, 1};
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long b, w;
  cin >> b >> w;
  vector<pair<long long, long long>> v(n - 1);
  for (long long i = 0; i < n; i++) {
    cin >> v[i].first >> v[i].second;
  }
  sort(v.rbegin(), v.rend());
  long long j = 0;
  priority_queue<long long, vector<long long>, greater<long long>> q;
  while (j < n - 1 && v[j].first > b) {
    q.push(v[j].second - v[j].first + 1);
    j++;
  }
  long long ans = q.size() + 1;
  while (q.size() && q.top() <= b) {
    long long x = q.top();
    q.pop();
    b -= x;
    while (j < n - 1 && v[j].first > b) {
      q.push(v[j].second - v[j].first + 1);
      j++;
    }
    ans = min(ans, (long long)q.size() + 1);
  }
  ans = min(ans, (long long)q.size() + 1);
  cout << ans << "\n";
}
