#include <bits/stdc++.h>

using namespace std;


pair<long long, long long> a[10020];
int n;

int main()
{
   cin >> n;
   for (int i = 0; i < n; i++)
   {
       cin >> a[i].first >> a[i].second;
   }
   long long res = 0;
   long long nak = 0;
   sort(a, a + n);
   nak = a[0].first;
   if (nak >= a[0].second)
   {
   res += 1;
   nak -= a[0].second;
   }
   for (int i = 1; i < n; i++)
   {
       nak += a[i].first - a[i-1].first;
        if (nak >= a[i].second)
        {
            res++;
            nak -= a[i].second;
        }
   }
   cout << res;
   return 0;
}
