#include <bits/stdc++.h>

#define fr first
#define sc second
#define mk make_pair

using namespace std;

struct st{
    int a, b, ind;
};
int n;
bool u[5001][5001];
pair<int, int> ar[10001];
st ars[100001];

int t[5001][20001];
int N = 20001;

bool cmp(st a, st b)
{
    return (a.b < b.b);
}

int get(int x, int tl, int tr, int k, int v)
{
    if(tl > k)
        return 2e9;
    if(tr <= k)
        return t[x][v];
    else
    {
        int tm = (tr + tl) >> 1;
        return min(get(x, tl, tm, k, v + v), get(x, tm + 1, tr, k, v + v + 1));
    }
}

void update(int x, int tl, int tr, int k, int y, int v)
{
    if(tr == tl)
        t[x][v] = min(t[x][v], y);
    else
    {
        int tm = (tr + tl) >> 1;
        if(k <= tm)
            update(x, tl, tm, k, y, v + v);
        else
            update(x, tm + 1, tr, k, y, v + v + 1);

        t[x][v] = min(t[x][v + v], t[x][v + v + 1]);
    }
}

int main()
{
    cin >> n;
    for(int i = 1; i <= n; i++)
        scanf("%d%d", &ar[i].fr, &ar[i].sc);

    sort(ar + 1, ar + n + 1);

    for(int i = 1; i <= n; i++)
    {
        ars[i].a = ar[i].fr;
        ars[i].ind = i;
        ars[i].b = ar[i].sc;
    }

    sort(ars + 1, ars + n + 1, &cmp);

    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= n * 4; j++)
            t[i][j] = 2e9;

    int ans = 0;
    for(int i = 1; i <= n; i++)
    {
        int a = ars[i].a;
        int ind = ars[i].ind;
        int b = ars[i].b;
        for(int j = 0; j <= i; j++)
        {
            //cout << i << endl;
            int x = get(j, 1, n, ind, 1);
            int l = 0, r = n + 1;
            while(r - l > 1)
            {
                int mid = (r + l) >> 1;
                if(x + b <= ar[mid].fr)
                    r = mid;
                else
                    l = mid;
            }

            if(r <= n)
            {
                update(j + 1, 1, n, r, x + b, 1);
                ans = max(ans, j + 1);
            }
        }
    }
    cout << ans;
    return 0;
}
