#include <bits/stdc++.h>
const int N = 300005;
long long a[N], b[N];
std::vector<std::pair<long long, long long> > v;
std::priority_queue<long long, std::vector<long long>, std::greater<long long> >
    q;
inline void chmax(long long &a, const long long &b) { (a < b) && (a = b); }
inline void chmin(int &a, const int &b) { (a > b) && (a = b); }
int main() {
  int n;
  long long st, nt;
  scanf("%d %lld %lld", &n, &st, &nt);
  --n;
  for (int i = 1; i <= n; ++i) scanf("%lld %lld", &a[i], &b[i]);
  int ans = 1;
  long long maxx = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[i] <= st) {
      chmax(maxx, a[i]);
      v.push_back(std::make_pair(a[i], b[i]));
    } else {
      ++ans;
      q.push(b[i] - a[i] + 1);
    }
  }
  std::sort(v.begin(), v.end());
  int res = ans;
  while (!q.empty() && st > 0) {
    long long tmp = q.top();
    q.pop();
    if (st >= tmp) {
      st -= tmp;
      --ans;
      std::vector<std::pair<long long, long long> >::iterator it =
          std::upper_bound(v.begin(), v.end(),
                           std::make_pair(st, 0x7fffffffffffffffll));
      ans += v.end() - it;
      for (std::vector<std::pair<long long, long long> >::iterator itt = it;
           itt != v.end(); ++itt) {
        q.push(itt->second - itt->first + 1);
      }
      v.erase(it, v.end());
      chmin(res, ans);
    } else
      break;
  }
  printf("%d\n", res);
  return 0;
}
