#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 21;
pair<long long, long long> up[N], down[N];
bool cmp1(pair<long long, long long> &a, pair<long long, long long> &b) {
  return a.first - a.second > b.first - b.second;
}
bool cmp2(pair<long long, long long> &a, pair<long long, long long> &b) {
  return a.first > b.first;
}
multiset<long long> st;
int main() {
  int n;
  scanf("%d", &n);
  int u = 0;
  int d = 0;
  long long t, w;
  scanf("%lld%lld", &t, &w);
  for (int i = 1; i < n; i++) {
    long long foo, bar;
    scanf("%lld%lld", &foo, &bar);
    if (foo > t) {
      st.insert(bar - foo);
    } else {
      down[d++] = make_pair(foo, bar);
    }
  }
  sort(down, down + d, cmp2);
  int p = 0;
  int ans = N;
  while (t >= 0) {
    ans = min(ans, (int)st.size() + 1);
    if (not st.size()) {
      break;
    }
    long long now = *st.begin();
    st.erase(st.begin());
    t -= now + 1;
    while (p < d and down[p].first > t) {
      st.insert(down[p].second - down[p].first);
      p++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
