#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
#define ll long long
ll mod = 998244353;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll binpow(ll a, ll b)
{
ll res = 1;
while (b>0)
{
if (b&1)
res = (res*a)%mod;
a = (a*a)%mod;
b>>=1;
}
return res;
}
ll gcd(ll x, ll y)
{
if (y==0)
return x;
return gcd(y, x%y);
}
const ll maxi = 5e5;
ll a[maxi];
ll st[4*maxi];
ll getans(ll l, ll r, ll v, ll ql, ll qr)
{
if (l>qr or r<ql)
return INT_MIN;
if (l>=ql and r<=qr)
return st[v];
ll mid = (l+r)/2;
return max(getans(l, mid, 2*v, ql, qr), getans(mid+1, r, 2*v+1, ql, qr));
}
void update(ll l, ll r, ll v, ll ind, ll val)
{
if (ind<l or ind>r)
return;
if (l==r)
{
st[v] = val;
return;
}
ll mid = (l+r)/2;
update(l, mid, 2*v, ind, val);
update(mid+1, r, 2*v+1, ind, val);
st[v] = max(st[2*v], st[2*v+1]);
}
void solve()
{
ll n;
cin>>n;
vector<ll>dp(n+1, 1);
priority_queue<pair<ll,ll>, vector<pair<ll,ll>>, greater<pair<ll,ll>>>pq;
ll res = 0;
for (int i=1 ; i<=n ; i++)
{
while (!pq.empty())
{
auto it = pq.top();
if (it.first>i) break;
pq.pop();
update(1, n, 1, it.second, dp[it.second]);
}
ll x,y;
cin>>x>>y;
x = max(0ll, i-x-1);
if (x!=0) dp[i] = getans(1, n, 1, 1, x) + 1;
// cout<<x<<endl;
if (i+y+1<=n) pq.push({i+y+1, i});
res = max(res, dp[i]);
}
cout<<res<<endl;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
ll tt = 1;
// cin>>tt;
while (tt--)
{
solve();
}
return 0;
}