#include <iostream>
#include <algorithm>
using namespace std;
int main(void)
{
    int n, i;
    cin>>n;
    int t[n];
    int d[n];
    for ( i=0; i<n; i++)
        cin>>t[i]>>d[i];
    for (i=1; i<n; i++)
        t[i]-=t[i-1];
    int time[n];
    int time1[n];
    for ( i=1; i<n; i++)
        time[i]=-1000000000;
    time[0]=0;
    for ( i=0; i<n; i++)
    {
        time[0]+=t[i];
        for (int j=0; j<i; j++)
        {
            time1[j+1]=max(time[j+1]+t[i], time[j]-d[j+1]+t[i]);
        }
    }i=n-1;
    while (time[i]<0) i--;
    cout<<i<<endl;
}
