#include <bits/stdc++.h>
using namespace std;
pair<unsigned long long int, unsigned long long int> team[300005];
int tree[300005 << 2], pos[300005];
unsigned long long int vet[300005];
void update(int i);
void build(int p, int l, int r);
int query(int p, int l, int r, int ql, int qr);
int main() {
  int n;
  pair<unsigned long long int, unsigned long long int> me;
  cin >> n;
  cin >> me.first >> me.second;
  n--;
  for (int i = 1; i <= n; i++) cin >> team[i].first >> team[i].second;
  sort(team + 1, team + n + 1);
  for (int i = 1; i <= n; i++) vet[i] = team[i].second - team[i].first + 1;
  build(1, 1, n);
  int ans = lower_bound(team + 1, team + n + 1,
                        pair<unsigned long long int, unsigned long long int>(
                            me.first, -1)) -
            team;
  if (ans == n + 1) {
    printf("1\n");
    return 0;
  }
  int cont = 0, pos = ans;
  while (1) {
    int id = query(1, 1, n, pos, n);
    unsigned long long int need = vet[id];
    if (need > me.first) break;
    cont++;
    update(id);
    me.first -= need;
    pos = lower_bound(team + 1, team + n + 1,
                      pair<unsigned long long int, unsigned long long int>(
                          me.first, -1)) -
          team;
    ans = max(ans, pos + cont);
    if (cont == n) break;
  }
  printf("%d\n", n + 2 - ans);
  return 0;
}
void build(int p, int l, int r) {
  if (l == r) {
    tree[p] = l;
    pos[l] = p;
  } else {
    int mid = (l + r) >> 1;
    build(p << 1, l, mid);
    build(p << 1 | 1, mid + 1, r);
    int a = tree[p << 1], b = tree[p << 1 | 1];
    if (vet[a] < vet[b])
      tree[p] = a;
    else
      tree[p] = b;
  }
}
int query(int p, int l, int r, int ql, int qr) {
  if (l > qr || r < ql) return -1;
  if (l >= ql && r <= qr) return tree[p];
  int mid = (l + r) >> 1;
  int a = query(p << 1, l, mid, ql, qr);
  int b = query(p << 1 | 1, mid + 1, r, ql, qr);
  if (a == -1) return b;
  if (b == -1) return a;
  if (vet[a] < vet[b])
    return a;
  else
    return b;
}
void update(int i) {
  int p = pos[i];
  vet[i] = (1ULL << 63);
  while (p >>= 1) {
    int a = tree[p << 1], b = tree[p << 1 | 1];
    if (vet[a] < vet[b])
      tree[p] = a;
    else
      tree[p] = b;
  }
}
