#include <stdio.h>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int n;
struct pt
{
	int x, w;
} p[200010];
bool cmp(pt a, pt b)
{
	return a.x < b.x;
}

set <int> sums;
int sorted[200010], pt = 0;
map <int, int> mapped;

int t[800010];

void build(int v, int l, int r)
{
	if (l == r)
		t[v] = -1;
	else
	{
		int mid = (l + r) >> 1;
		build(v << 1, l, mid);
		build((v << 1) + 1, mid + 1, r);
		t[v] = -1;
	}
}

int query(int v, int tl, int tr, int l, int r)
{
	if (l > r)
		return -1;
	if (tl == l && tr == r)
		return t[v];
	int mid = (tl + tr) >> 1;
	return max(query(v << 1, tl, mid, l, min(r, mid)), query((v << 1) + 1, mid + 1, tr, max(l, mid + 1), r));
}

void update(int v, int l, int r, int x, int val)
{
	if (l == r)
		t[v] = val;
	else
	{
		int mid = (l + r) >> 1;
		if (x <= mid)
			update(v << 1, l, mid, x, val);
		else
			update((v << 1) + 1, mid + 1, r, x, val);
		t[v] = max(t[v << 1], t[(v << 1) + 1]);
	}
}

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
		scanf("%d %d", &p[i].x, &p[i].w);
	sort(p, p + n, cmp);
	for (int i = 0; i < n; ++i)
		sums.insert(p[i].x + p[i].w);
	while (!sums.empty())
	{
		sorted[pt] = *sums.begin();
		sums.erase(sums.begin());
		mapped[sorted[pt]] = pt;
		++pt;
	}
	build(1, 0, n - 1);
	update(1, 0, n - 1, mapped[p[0].x + p[0].w], 1);
	for (int i = 1; i < n; ++i)
	{
		int ll = -1, rr = n;
		while (ll < rr - 1)
		{
			int mid = (ll + rr) >> 1;
			if (sorted[mid] <= p[i].x - p[i].w)
				ll = mid;
			else
				rr = mid;
		}
		int z = query(1, 0, n - 1, 0, ll);
		if (z > -1)
			update(1, 0, n - 1, mapped[p[i].x + p[i].w], z + 1);
		else
			update(1, 0, n - 1, mapped[p[i].x + p[i].w], 1);
	}
	printf("%d\n", t[1]);
	return 0;
}


#include <stdio.h>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int n;
struct pts
{
	int x, w;
} p[200010];
bool cmp(pts a, pts b)
{
	return a.x < b.x;
}

set <int> sums;
int sorted[200010], pt = 0;
map <int, int> mapped;

int t[800010];

void build(int v, int l, int r)
{
	if (l == r)
		t[v] = -1;
	else
	{
		int mid = (l + r) >> 1;
		build(v << 1, l, mid);
		build((v << 1) + 1, mid + 1, r);
		t[v] = -1;
	}
}

int query(int v, int tl, int tr, int l, int r)
{
	if (l > r)
		return -1;
	if (tl == l && tr == r)
		return t[v];
	int mid = (tl + tr) >> 1;
	return max(query(v << 1, tl, mid, l, min(r, mid)), query((v << 1) + 1, mid + 1, tr, max(l, mid + 1), r));
}

void update(int v, int l, int r, int x, int val)
{
	if (l == r)
		t[v] = max(t[v], val);
	else
	{
		int mid = (l + r) >> 1;
		if (x <= mid)
			update(v << 1, l, mid, x, val);
		else
			update((v << 1) + 1, mid + 1, r, x, val);
		t[v] = max(t[v << 1], t[(v << 1) + 1]);
	}
}

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
		scanf("%d %d", &p[i].x, &p[i].w);
	sort(p, p + n, cmp);
	for (int i = 0; i < n; ++i)
		sums.insert(p[i].x + p[i].w);
	while (!sums.empty())
	{
		sorted[pt] = *sums.begin();
		sums.erase(sums.begin());
		++pt;
	}
	for (int i = 0; i < pt; ++i)
		mapped[sorted[i]] = i;
	build(1, 0, pt - 1);
	update(1, 0, pt - 1, mapped[p[0].x + p[0].w], 1);
	for (int i = 1; i < n; ++i)
	{
		int ll = -1, rr = pt;
		while (ll < rr - 1)
		{
			int mid = (ll + rr) >> 1;
			if (sorted[mid] <= p[i].x - p[i].w)
				ll = mid;
			else
				rr = mid;
		}
		int z = query(1, 0, pt - 1, 0, ll);
		if (z > -1)
			update(1, 0, pt - 1, mapped[p[i].x + p[i].w], z + 1);
		else
			update(1, 0, pt - 1, mapped[p[i].x + p[i].w], 1);
	}
	printf("%d\n", t[1]);
	return 0;
}


#include <stdio.h>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int n;
struct pt
{
	int x, w;
} p[200010];
bool cmp(pt a, pt b)
{
	return a.x < b.x;
}

set <int> sums;
int sorted[200010], pt = 0;
map <int, int> mapped;

int t[800010];

void build(int v, int l, int r)
{
	if (l == r)
		t[v] = -1;
	else
	{
		int mid = (l + r) >> 1;
		build(v << 1, l, mid);
		build((v << 1) + 1, mid + 1, r);
		t[v] = -1;
	}
}

int query(int v, int tl, int tr, int l, int r)
{
	if (l > r)
		return -1;
	if (tl == l && tr == r)
		return t[v];
	int mid = (tl + tr) >> 1;
	return max(query(v << 1, tl, mid, l, min(r, mid)), query((v << 1) + 1, mid + 1, tr, max(l, mid + 1), r));
}

void update(int v, int l, int r, int x, int val)
{
	if (l == r)
		t[v] = val;
	else
	{
		int mid = (l + r) >> 1;
		if (x <= mid)
			update(v << 1, l, mid, x, val);
		else
			update((v << 1) + 1, mid + 1, r, x, val);
		t[v] = max(t[v << 1], t[(v << 1) + 1]);
	}
}

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
		scanf("%d %d", &p[i].x, &p[i].w);
	sort(p, p + n, cmp);
	for (int i = 0; i < n; ++i)
		sums.insert(p[i].x + p[i].w);
	while (!sums.empty())
	{
		sorted[pt] = *sums.begin();
		sums.erase(sums.begin());
		if (mapped.find(sorted[pt]) == mapped.end())
			mapped[sorted[pt]] = pt;
		++pt;
	}
	build(1, 0, n - 1);
	update(1, 0, n - 1, mapped[p[0].x + p[0].w], 1);
	for (int i = 1; i < n; ++i)
	{
		int ll = -1, rr = n;
		while (ll < rr - 1)
		{
			int mid = (ll + rr) >> 1;
			if (sorted[mid] <= p[i].x - p[i].w)
				ll = mid;
			else
				rr = mid;
		}
		int z = query(1, 0, n - 1, 0, ll);
		if (z > -1)
			update(1, 0, n - 1, mapped[p[i].x + p[i].w], z + 1);
		else
			update(1, 0, n - 1, mapped[p[i].x + p[i].w], 1);
	}
	printf("%d\n", t[1]);
	return 0;
}


#include <stdio.h>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int n;
struct pt
{
	int x, w;
} p[200010];
bool cmp(pt a, pt b)
{
	return a.x < b.x;
}

set <int> sums;
int sorted[200010], pt = 0;
map <int, int> mapped;

int t[800010];

void build(int v, int l, int r)
{
	if (l == r)
		t[v] = -1;
	else
	{
		int mid = (l + r) >> 1;
		build(v << 1, l, mid);
		build((v << 1) + 1, mid + 1, r);
		t[v] = -1;
	}
}

int query(int v, int tl, int tr, int l, int r)
{
	if (l > r)
		return -1;
	if (tl == l && tr == r)
		return t[v];
	int mid = (tl + tr) >> 1;
	return max(query(v << 1, tl, mid, l, min(r, mid)), query((v << 1) + 1, mid + 1, tr, max(l, mid + 1), r));
}

void update(int v, int l, int r, int x, int val)
{
	if (l == r)
		t[v] = max(t[v], val);
	else
	{
		int mid = (l + r) >> 1;
		if (x <= mid)
			update(v << 1, l, mid, x, val);
		else
			update((v << 1) + 1, mid + 1, r, x, val);
		t[v] = max(t[v << 1], t[(v << 1) + 1]);
	}
}

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
		scanf("%d %d", &p[i].x, &p[i].w);
	sort(p, p + n, cmp);
	for (int i = 0; i < n; ++i)
		sums.insert(p[i].x + p[i].w);
	while (!sums.empty())
	{
		sorted[pt] = *sums.begin();
		sums.erase(sums.begin());
		++pt;
	}
	for (int i = 0; i < pt; ++i)
		mapped[sorted[pt]] = i;
	build(1, 0, n - 1);
	update(1, 0, n - 1, mapped[p[0].x + p[0].w], 1);
	for (int i = 1; i < n; ++i)
	{
		int ll = -1, rr = n;
		while (ll < rr - 1)
		{
			int mid = (ll + rr) >> 1;
			if (sorted[mid] <= p[i].x - p[i].w)
				ll = mid;
			else
				rr = mid;
		}
		int z = query(1, 0, n - 1, 0, ll);
		if (z > -1)
			update(1, 0, n - 1, mapped[p[i].x + p[i].w], z + 1);
		else
			update(1, 0, n - 1, mapped[p[i].x + p[i].w], 1);
	}
	printf("%d\n", t[1]);
	return 0;
}


#include <stdio.h>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int n;
struct pt
{
	int x, w;
} p[200010];
bool cmp(pt a, pt b)
{
	return a.x < b.x;
}

set <int> sums;
int sorted[200010], pt = 0;
map <int, int> mapped;

int t[800010];

void build(int v, int l, int r)
{
	if (l == r)
		t[v] = -1;
	else
	{
		int mid = (l + r) >> 1;
		build(v << 1, l, mid);
		build((v << 1) + 1, mid + 1, r);
		t[v] = -1;
	}
}

int query(int v, int tl, int tr, int l, int r)
{
	if (l > r)
		return -1;
	if (tl == l && tr == r)
		return t[v];
	int mid = (tl + tr) >> 1;
	return max(query(v << 1, tl, mid, l, min(r, mid)), query((v << 1) + 1, mid + 1, tr, max(l, mid + 1), r));
}

void update(int v, int l, int r, int x, int val)
{
	if (l == r)
		t[v] = max(t[v], val);
	else
	{
		int mid = (l + r) >> 1;
		if (x <= mid)
			update(v << 1, l, mid, x, val);
		else
			update((v << 1) + 1, mid + 1, r, x, val);
		t[v] = max(t[v << 1], t[(v << 1) + 1]);
	}
}

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
		scanf("%d %d", &p[i].x, &p[i].w);
	sort(p, p + n, cmp);
	for (int i = 0; i < n; ++i)
		sums.insert(p[i].x + p[i].w);
	while (!sums.empty())
	{
		sorted[pt] = *sums.begin();
		sums.erase(sums.begin());
		++pt;
	}
	for (int i = 0; i < pt; ++i)
		mapped[sorted[pt]] = i;
	build(1, 0, pt - 1);
	update(1, 0, pt - 1, mapped[p[0].x + p[0].w], 1);
	for (int i = 1; i < n; ++i)
	{
		int ll = -1, rr = pt;
		while (ll < rr - 1)
		{
			int mid = (ll + rr) >> 1;
			if (sorted[mid] <= p[i].x - p[i].w)
				ll = mid;
			else
				rr = mid;
		}
		int z = query(1, 0, pt - 1, 0, ll);
		if (z > -1)
			update(1, 0, pt - 1, mapped[p[i].x + p[i].w], z + 1);
		else
			update(1, 0, pt - 1, mapped[p[i].x + p[i].w], 1);
	}
	printf("%d\n", t[1]);
	return 0;
}


#include <iostream>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>

using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define mp make_pair
#define ft first
#define sc second
#define endl '\n'
#define sqr(x) ((x) * (x))

typedef long long li;
typedef long double ld;
typedef pair<int, int> pt;

const int INF = (int)(1e9);
const li INF64 = (li)(INF) * (li)(INF);
const ld eps = 1e-9;
const ld PI = ld(3.1415926535897932384626433832795);

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};

//#define TASK_NAME "name"
//#define _DEBUG

const int N = 2e5 + 555;

int n;
pt a[N];
int d[N];

struct pot{
    int l, r, id;
} b[N];

bool operator <(const pot &a, const pot &b){
    if(a.r == b.r){
        if(a.l == b.l)
            return a.id < b.id;
        return a.l < b.l;
    }
    return a.r < b.r;
}

inline bool read(){
    if(scanf("%d", &n) != 1)
        return false;
    forn(i, n){
        int pos, w;
        scanf("%d %d", &pos, &w);
        a[i] = mp(pos - w, pos + w);
    }
    return true;
}

inline void solve(){
    sort(a, a + n);
    forn(i, n){
        b[i].l = a[i].ft;
        b[i].r = a[i].sc;
        b[i].id = i;
    }
    sort(b, b + n);

    set<int> bs;
    int uk = 0;
    forn(i, n){
        int gr = a[i].ft;
        while (uk < n && b[uk].r <= gr){
            bs.insert(d[b[uk].id]);
            uk++;
        }
        int ba = 0;
        if(!bs.empty())
            ba = max(ba, *bs.rbegin());
        d[i] = ba + 1;
    }

    while (uk < n){
        bs.insert(d[b[uk].id]);
        uk++;
    }
    cout << *bs.rbegin();
}

int main(){
#ifdef TASK_NAME
    freopen(TASK_NAME".in", "r", stdin);
    freopen(TASK_NAME".out", "w", stdout);
#else
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
#endif

    srand(int(time(NULL)));

    assert(read());
    solve();

    return 0;
}


#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <bitset>
#include <time.h>
#define MAXID 500000
#define ll long long
using namespace std;

ll tree[MAXID+10];

ll read(int idx){
	ll maxval = 0;
	while (idx <= MAXID){
		maxval = max(maxval, tree[idx]);
		idx += (idx & -idx);
	}
	return maxval;
}

void update(int idx, ll v){
	while (idx > 0){
		tree[idx] = max(tree[idx], v);
		idx -= (idx & -idx);
	}
}

vector<pair<ll,ll> > XW;
set<ll> diff_xw;
int num_ids;
map<ll,int> ids;
int main() {
    int n;
    cin>>n;

    for(int i=1;i<=n;i++) {
        int x,w;
        cin>>x>>w;
        XW.push_back(make_pair(x,w));
        diff_xw.insert(x-w);
        diff_xw.insert(x+w);
    }

    num_ids=0;
    for(set<ll>::iterator it = diff_xw.begin();
        it != diff_xw.end();
        ++it) {
        ids[*it]=num_ids+1;
        num_ids++;
    }

    sort(XW.begin(), XW.end());

    for(int j=0;j<=MAXID;j++)
        tree[j]=0;
    ll answer = 0;
    for (int j=(int)XW.size()-1;j>=0;j--) {
        ll summ = XW[j].first + XW[j].second;
        ll diff = XW[j].first - XW[j].second;
        int id = ids[summ];
        ll curr = read(id) + 1;
        answer = max(answer, curr);
        update(ids[diff], curr);
    }

    cout << answer << endl;

}


#include <stdio.h>
#include <algorithm>
const int IT_MAX = 262144;
int it[IT_MAX*2];
int ans[200050];
struct data {
    int a, b;
    bool operator < (const data & l) const {
        if(a!=l.a) return a<l.a;
        else return b<l.b;
    }
} d[200050];
int MAX(int a, int b) {
    if(a<b) return b;
    else return a;
}
void update(int pos, int num) {
    it[pos] = num;
    while(pos > 1) {
        pos /= 2;
        it[pos] = MAX(it[pos*2], it[pos*2+1]);
    }
    return;
}
int get_max(int pos1, int pos2) {
    if(pos1 > pos2) return 0;
    int t = 0;
    if(pos1 == pos2) return it[pos1];
    if(pos1 % 2 == 1) {
        t = it[pos1];
        pos1++;
    }
    if(pos1 == pos2) return MAX(t, it[pos1]);
    if(pos2 % 2 == 0) {
        t = it[pos2];
        pos2--;
    }
    return MAX(t, get_max(pos1/2, pos2/2));
}
int bin_search(int x, int y) {
    int ans = -1, st = 0, en = y-1, mi;
    while(st <= en) {
         mi = (st+en)/2;
         if(d[mi].a <= x) {
             ans = mi;
             st = mi+1;
         }
         else en = mi-1;
    }
    return ans;
}
int main() {
    int N, i, t1, t2;
    scanf("%d", &N);
    for(i = 0; i < N; i++) {
        scanf("%d %d", &t1, &t2);
        d[i].a = t1+t2, d[i].b = t1-t2;
    }
    std::sort(d, d+N);
    for(i = 0; i < N; i++) {
        t1 = bin_search(d[i].b, N);
        t2 = get_max(IT_MAX, IT_MAX+t1);
        ans[i] = t2+1;
        update(IT_MAX+i, ans[i]);
    }
    int ANS = 0;
    for(i = 0; i < N; i++) if(ANS < ans[i]) ANS = ans[i];
    printf("%d", ANS);
    return 0;
}


#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;

#pragma comment(linker, "/STACK:66777216")

#define r(n) scanf("%d", &n)
#define w(n) printf("%d\n", n)
#define FOR(i, n) for(int i=0; i<(n); ++i)
#define FORC(i, n) for(int i=0; (n); ++i)
#define REP(i, a, b) for(int i=(a); i<(b); ++i)
#define mp make_pair
#define pb push_back
#define L(s) ((int)((s).size()))
#define sq(x) ((x)*(x))
#define sign(x) ( ((x) > 0) ? 1 : -1)

#define ll long long
#define INF 1000000000
#define eps e-8

#define maxn 200005

int n;
pair <int, int> A[maxn];
pair <int, int> L[maxn];
int M[maxn], Ans[maxn];

int main()
{
	r(n);
	FOR(i, n) {
		r(A[i].first);
		r(A[i].second);
	}

	FOR(i, n) L[i] = mp(A[i].first - A[i].second, i);

	sort(L, L+n);
	M[n] = 0;
	int k;
	int t;
	for(int i = n-1; i>=0; --i) {
		t = L[i].second;
		k = lower_bound(L, L+n, mp(A[t].first + A[t].second, -1)) - L;
		Ans[i] = M[k] + 1;

		M[i] = max(Ans[i], M[i+1]);
	}

	w(M[0]);

}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <map>
#include <queue>
using namespace std;

const long long INF = 1e9 + 1;
int d[200004];

int n;
vector <pair<long long, long long>> p;

int calc(int i)
{
    if (d[i] != -1)
    {
        return d[i];
    }
    if (i == n) return d[n] = 0;
    long long r = p[i].second;
    int idx = -1;
    if (lower_bound(p.begin(), p.end(), make_pair(r, -INF)) != p.end())
    {
        idx = (lower_bound(p.begin(), p.end(), make_pair(r, -INF)) - p.begin());
    }
    else
    {
        idx = n;
    }
    if (idx == i) idx++;
    d[i] = max(calc(i + 1), calc(idx) + 1);
    return d[i];

}
int main()
{
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        long long x, w;
        scanf("%I64d %I64d", &x, &w);
        p.push_back(make_pair(x - w, x + w));
    }

    sort(p.begin(), p.end());
    for (int i = 0; i < 200004; i++)
    {
        d[i] = -1;
    }
    d[0] = calc(0);
    cout << d[0];
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <string>
#include <iostream>

using namespace std;

#define INF 1000000007
#define MAXN 400010
#define MAXTREE 2000010

int x[MAXN], w[MAXN];
map<int, int> indice;
int tree[MAXTREE];
pair<int, int> vet[MAXN];

int query(int no, int a, int b, int i, int j) {
    if (i==a && j==b) {
        return tree[no];
    }
    else {
        int meio=(a+b)/2;
        int esq=2*no;
        int dir=2*no+1;
        if (j<=meio) {
            return query(esq, a, meio, i, j);
        }
        else if (i>meio) {
            return query(dir, meio+1, b, i, j);
        }
        else {
            return query(esq, a, meio, i, meio)+query(dir, meio+1, b, meio+1, j);
        }
    }
}

void update(int no, int a, int b, int x) {
    if (a==b) {
        tree[no]++;
    }
    else {
        int meio=(a+b)/2;
        int esq=2*no;
        int dir=2*no+1;
        if (x<=meio) {
            update(esq, a, meio, x);
        }
        else {
            update(dir, meio+1, b, x);
        }
        tree[no]=tree[esq]+tree[dir];
    }
}

int main() {
    int n;
    scanf("%d", &n);
    int i;
    for (i=1; i<=n; i++) {
        scanf("%d %d", &x[i], &w[i]);
        indice[x[i]-w[i]];
        indice[x[i]+w[i]];
        vet[i]=make_pair(x[i], w[i]);
    }
    int tam=0;
    map<int, int>::iterator iter;
    for (iter=indice.begin(); iter!=indice.end(); iter++) {
        indice[iter->first]=++tam;
    }
    sort(vet+1, vet+1+n);
    memset(tree, 0, sizeof(tree));
    int res=0;
    for (i=1; i<=n; i++) {
        x[i]=vet[i].first;
        w[i]=vet[i].second;
      //  printf("pesquisar %d %d\n", x[i]-w[i], indice[x[i]-w[i]]);
        res=max(res, query(1, 1, tam, 1, indice[x[i]-w[i]]));
        //printf("atualizar %d %d\n", x[i]+w[i], indice[x[i]+w[i]]);
        update(1, 1, tam, indice[x[i]+w[i]]);
    }
    printf("%d\n", res);
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <string>
#include <iostream>

using namespace std;

#define INF 1000000007
#define MAXN 400010
#define MAXTREE 2000010

int x[MAXN], w[MAXN];
map<int, int> indice;
int tree[MAXTREE];
pair<int, int> vet[MAXN];

int query(int no, int a, int b, int i, int j) {
    if (i==a && j==b) {
        return tree[no];
    }
    else {
        int meio=(a+b)/2;
        int esq=2*no;
        int dir=2*no+1;
        if (j<=meio) {
            return query(esq, a, meio, i, j);
        }
        else if (i>meio) {
            return query(dir, meio+1, b, i, j);
        }
        else {
            return max(query(esq, a, meio, i, meio), query(dir, meio+1, b, meio+1, j));
        }
    }
}

void update(int no, int a, int b, int x, int val) {
    if (a==b) {
        tree[no]=max(tree[no], val);
    }
    else {
        int meio=(a+b)/2;
        int esq=2*no;
        int dir=2*no+1;
        if (x<=meio) {
            update(esq, a, meio, x, val);
        }
        else {
            update(dir, meio+1, b, x, val);
        }
        tree[no]=max(tree[esq], tree[dir]);
    }
}

int main() {
    int n;
    scanf("%d", &n);
    int i;
    for (i=1; i<=n; i++) {
        scanf("%d %d", &x[i], &w[i]);
        indice[x[i]-w[i]];
        indice[x[i]+w[i]];
        vet[i]=make_pair(x[i], w[i]);
    }
    int tam=0;
    map<int, int>::iterator iter;
    for (iter=indice.begin(); iter!=indice.end(); iter++) {
        indice[iter->first]=++tam;
    }
    sort(vet+1, vet+1+n);
    memset(tree, 0, sizeof(tree));
    int res=0;
    for (i=1; i<=n; i++) {
        x[i]=vet[i].first;
        w[i]=vet[i].second;
        int atual=1+query(1, 1, tam, 1, indice[x[i]-w[i]]);
        res=max(res, atual);
        //printf("atualizar %d %d\n", x[i]+w[i], indice[x[i]+w[i]]);
        update(1, 1, tam, indice[x[i]+w[i]], atual);
    }
    printf("%d\n", res);
    return 0;
}


#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_DEPRECATE
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <utility>
#include <memory.h>
#include <sstream>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <vector>
#include <ctime>
#include <bitset>
#include <cassert>
#include <iomanip>
using namespace std;

#define forn(i,n)  for(int i = 0; i < (n); ++i)
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define fskfs x
#define sfdjh y
#define pii pair<int, int>
#define mod 1000000007
#define inf 2000000000
#define eps 1e-8
#define sq(x) ((x) * (x))
typedef long long ll;

int n, len = 0;
map<int, int>q;
int t[200010];
vector<pii>a;

void add(int x, int val)
{
    while (x < len)
    {
        t[x] = max(t[x], val);
        x = x | (x + 1);
    }
}

int get_max(int x)
{
    int mx = 0;
    while (x >= 0)
    {
        mx = max(t[x], mx);
        x = ( x & (x + 1) ) - 1;
    }
    return mx;
}

void init ()
{
    cin >> n;
    int x, y;
    vector<int>p;
    for (int i = 0; i < n; ++i)
    {
        cin >> x >> y;
        a.pb(pii(x, y));
        p.push_back(x + y);
        p.push_back(x - y);
    }
    for (int i = 0; i < p.size(); ++i)
        q[p[i]] = len++;
    sort(a.begin(), a.end());
}

void solve ()
{
    int ans = 1;
    for (int i = 0; i < n; ++i)
    {
        int val = a[i].first - a[i].second;
        if (val <= 0)
        {
            add(q[a[i].first + a[i].second], 1);
        }
        else
        {
            int res = get_max(q[val]) + 1;
            ans = max(ans, res);
            add(q[a[i].first + a[i].second], res);
        }
    }
    cout << ans;
}
int main()
{
   //freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout);
   ios_base::sync_with_stdio(false); cin.tie(0);
   init();
   solve();
 return 0;
}


#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_DEPRECATE
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <utility>
#include <memory.h>
#include <sstream>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <vector>
#include <ctime>
#include <bitset>
#include <cassert>
#include <iomanip>
using namespace std;

#define forn(i,n)  for(int i = 0; i < (n); ++i)
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define fskfs x
#define sfdjh y
#define pii pair<int, int>
#define mod 1000000007
#define inf 2000000000
#define eps 1e-8
#define sq(x) ((x) * (x))
typedef long long ll;

int n;
set<pii>q;
void init ()
{
    cin >> n;
    int x, y;
    for (int i = 0; i < n; ++i)
    {
        cin >> x >> y;
        q.insert(pii(x, y));
    }
}

void solve ()
{
    int mx = 0;

    while (!q.empty())
    {
        set<pii>::iterator d = q.begin();
        pii t = pii(d->first, d->second);
        q.erase(d);
        int cur = 1;
       // vector<set<pii>::iterator>a;
        for (set<pii>::iterator it = q.begin(); it != q.end(); ++it)
        {
            if ((it->first - t.first) >= (it->second + t.second))
            {
            //    a.pb(it);
                ++cur;
            }
        }
        mx = max(cur, mx);
       /* for (int i = 0; i < (int)a.size(); ++i)
            q.erase(a[i]);*/
    }
    cout << mx;
}
int main()
{
   //freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout);
   ios_base::sync_with_stdio(false); cin.tie(0);
   init();
   solve();
 return 0;
}


#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_DEPRECATE
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <utility>
#include <memory.h>
#include <sstream>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <vector>
#include <ctime>
#include <bitset>
#include <cassert>
#include <iomanip>
using namespace std;

#define forn(i,n)  for(int i = 0; i < (n); ++i)
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define fskfs x
#define sfdjh y
#define pii pair<int, int>
#define mod 1000000007
#define inf 2000000000
#define eps 1e-8
#define sq(x) ((x) * (x))
typedef long long ll;

int n, len = 0;
map<int, int>q;
int t[500010];
vector<pii>a;

void add(int x, int val)
{
    while (x < len)
    {
        t[x] = max(t[x], val);
        x = x | (x + 1);
    }
}

int get_max(int x)
{
    int mx = 0;
    while (x >= 0)
    {
        mx = max(t[x], mx);
        x = ( x & (x + 1) ) - 1;
    }
    return mx;
}

void init ()
{
    cin >> n;
    int x, y;
    vector<int>p;
    for (int i = 0; i < n; ++i)
    {
        cin >> x >> y;
        a.pb(pii(x, y));
        p.push_back(x + y);
        p.push_back(x - y);
    }
    sort(p.begin(), p.end());
    for (int i = 0; i < p.size(); ++i)
    {
        if (!q.count(p[i]) && p[i] >= 1)
            q[p[i]] = len++;
    }
    sort(a.begin(), a.end());
}

void solve ()
{
    int ans = 1;
    for (int i = 0; i < n; ++i)
    {
        int val = a[i].first - a[i].second;
        if (val <= 0)
        {
            add(q[a[i].first + a[i].second], 1);
        }
        else
        {
            int res = get_max(q[val]) + 1;
            ans = max(ans, res);
            add(q[a[i].first + a[i].second], res);
        }
    }
    cout << ans;
}
int main()
{
   //freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout);
   ios_base::sync_with_stdio(false); cin.tie(0);
   init();
   solve();
 return 0;
}


#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_DEPRECATE
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <utility>
#include <memory.h>
#include <sstream>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <vector>
#include <ctime>
#include <bitset>
#include <cassert>
#include <iomanip>
using namespace std;

#define forn(i,n)  for(int i = 0; i < (n); ++i)
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define fskfs x
#define sfdjh y
#define pii pair<int, int>
#define mod 1000000007
#define inf 2000000000
#define eps 1e-8
#define sq(x) ((x) * (x))
typedef long long ll;

int n;
set<pii>q;
void init ()
{
    cin >> n;
    int x, y;
    for (int i = 0; i < n; ++i)
    {
        cin >> x >> y;
        q.insert(pii(x, y));
    }
}

void solve ()
{
    int mx = 0;

    while (!q.empty())
    {
        set<pii>::iterator d = q.begin();
        pii t = pii(d->first, d->second);
        q.erase(d);
        int cur = 1;
        vector<set<pii>::iterator>a;
        for (set<pii>::iterator it = q.begin(); it != q.end(); ++it)
        {
            if ((it->first - t.first) >= (it->second + t.second))
            {
                a.pb(it);
                ++cur;
            }
        }
        mx = max(cur, mx);
        for (int i = 0; i < (int)a.size(); ++i)
            q.erase(a[i]);
    }
    cout << mx;
}
int main()
{
   //freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout);
   ios_base::sync_with_stdio(false); cin.tie(0);
   init();
   solve();
 return 0;
}


#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_DEPRECATE
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <utility>
#include <memory.h>
#include <sstream>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <vector>
#include <ctime>
#include <bitset>
#include <cassert>
#include <iomanip>
using namespace std;

#define forn(i,n)  for(int i = 0; i < (n); ++i)
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define fskfs x
#define sfdjh y
#define pii pair<int, int>
#define mod 1000000007
#define inf 2000000000
#define eps 1e-8
#define sq(x) ((x) * (x))
typedef long long ll;

int n, len = 0;
map<int, int>q;
int t[200010];
vector<pii>a;

void add(int x, int val)
{
    while (x < len)
    {
        t[x] = max(t[x], val);
        x = x | (x + 1);
    }
}

int get_max(int x)
{
    int mx = 0;
    while (x >= 0)
    {
        mx = max(t[x], mx);
        x = ( x & (x + 1) ) - 1;
    }
    return mx;
}

void init ()
{
    cin >> n;
    int x, y;
    for (int i = 0; i < n; ++i)
    {
        cin >> x >> y;
        a.pb(pii(x, y));
        q[x + y] = len++;
    }
    sort(a.begin(), a.end());
}

void solve ()
{
    int ans = 1;
    for (int i = 0; i < n; ++i)
    {
        int val = a[i].first - a[i].second;
        if (val <= 0)
        {
            add(q[a[i].first + a[i].second], 1);
        }
        else
        {
            int res = get_max(val) + 1;
            ans = max(ans, res);
            add(q[a[i].first + a[i].second], res);
        }
    }
    cout << ans;
}
int main()
{
   //freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout);
   ios_base::sync_with_stdio(false); cin.tie(0);
   init();
   solve();
 return 0;
}


#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_DEPRECATE
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <utility>
#include <memory.h>
#include <sstream>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <vector>
#include <ctime>
#include <bitset>
#include <cassert>
#include <iomanip>
using namespace std;

#define forn(i,n)  for(int i = 0; i < (n); ++i)
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define fskfs x
#define sfdjh y
#define pii pair<int, int>
#define mod 1000000007
#define inf 2000000000
#define eps 1e-8
#define sq(x) ((x) * (x))
typedef long long ll;

int n, len = 0;
map<int, int>q;
int t[200010];
vector<pii>a;

void add(int x, int val)
{
    while (x < len)
    {
        t[x] = max(t[x], val);
        x = x | (x + 1);
    }
}

int get_max(int x)
{
    int mx = 0;
    while (x >= 0)
    {
        mx = max(t[x], mx);
        x = ( x & (x + 1) ) - 1;
    }
    return mx;
}

void init ()
{
    cin >> n;
    int x, y;
    vector<int>p;
    for (int i = 0; i < n; ++i)
    {
        cin >> x >> y;
        a.pb(pii(x, y));
        p.push_back(x + y);
        p.push_back(x - y);
    }
    sort(p.begin(), p.end());
    for (int i = 0; i < p.size(); ++i)
    {
        if (!q.count(p[i]) && p[i] >= 1)
            q[p[i]] = len++;
    }
    sort(a.begin(), a.end());
}

void solve ()
{
    int ans = 1;
    for (int i = 0; i < n; ++i)
    {
        int val = a[i].first - a[i].second;
        if (val <= 0)
        {
            add(q[a[i].first + a[i].second], 1);
        }
        else
        {
            int res = get_max(q[val]) + 1;
            ans = max(ans, res);
            add(q[a[i].first + a[i].second], res);
        }
    }
    cout << ans;
}
int main()
{
   //freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout);
   ios_base::sync_with_stdio(false); cin.tie(0);
   init();
   solve();
 return 0;
}


#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_DEPRECATE
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <utility>
#include <memory.h>
#include <sstream>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <vector>
#include <ctime>
#include <bitset>
#include <cassert>
#include <iomanip>
using namespace std;

#define forn(i,n)  for(int i = 0; i < (n); ++i)
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define fskfs x
#define sfdjh y
#define pii pair<int, int>
#define mod 1000000007
#define inf 2000000000
#define eps 1e-8
#define sq(x) ((x) * (x))
typedef long long ll;

int n, len = 0;
map<int, int>q;
int t[200010];
vector<pii>a;

void add(int x, int val)
{
    while (x < len)
    {
        t[x] = max(t[x], val);
        x = x | (x + 1);
    }
}

int get_max(int x)
{
    int mx = 0;
    while (x >= 0)
    {
        mx = max(t[x], mx);
        x = ( x & (x + 1) ) - 1;
    }
    return mx;
}

void init ()
{
    cin >> n;
    int x, y;
    vector<int>p;
    for (int i = 0; i < n; ++i)
    {
        cin >> x >> y;
        a.pb(pii(x, y));
        p.push_back(x + y);
        p.push_back(x - y);
    }
    for (int i = 0; i < p.size(); ++i)
    {
        if (!q.count(p[i]))
            q[p[i]] = len++;
    }
    sort(a.begin(), a.end());
}

void solve ()
{
    int ans = 1;
    for (int i = 0; i < n; ++i)
    {
        int val = a[i].first - a[i].second;
        if (val <= 0)
        {
            add(q[a[i].first + a[i].second], 1);
        }
        else
        {
            int res = get_max(q[val]) + 1;
            ans = max(ans, res);
            add(q[a[i].first + a[i].second], res);
        }
    }
    cout << ans;
}
int main()
{
  // freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout);
   ios_base::sync_with_stdio(false); cin.tie(0);
   init();
   solve();
 return 0;
}


#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <cassert>
#include <memory>

using namespace std;

typedef pair<int,int> PII;
typedef pair<long,long> PLL;

const double PI = acos(-1.0);
const double EPS=1e-4;
const int MOD=(int)1e9+7;
const int dx[4]={-1,0,1,0};
const int dy[4]={0,1,0,-1};
const int N=200005;

template<class T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<class T> T lcm(T a,T b){return a/gcd(a,b)*b;}

struct Node{
	int x,w;
}node[200000];
int n;
bool cmp(const Node &a, const Node &b){
	return (a.x+a.w) < (b.x+b.w);
}
int main()
{
	while(scanf("%d",&n)!=EOF){
		for(int i=0;i<n;i++)
			scanf("%d%d",&node[i].x,&node[i].w);
		sort(node,node+n,cmp);
		int ans=1;
		int last=node[0].x+node[0].w;
		for(int i=1;i<n;i++)
			if(node[i].x-node[i].w>=last){
				ans++;
				last=node[i].x+node[i].w;
			}
		printf("%d\n",ans);
	}
	return 0;
}


#pragma comment(linker, "/STACK:256000000")
#define _USE_MATH_DEFINES
#define _CRT_NO_DEPRECEATE
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <memory.h>
#include <sstream>
#include <cassert>
#include <ctime>

#define pb push_back
#define ll long long
#define pll pair<ll, ll>
#define mp make_pair
#define sq(x) ((x)*(x))
#define tmin(x,y,z) (min(min((x),(y)),(z)))
#define _MOD 1000000009LL
#define MOD(x) (((x) + 2LL * (_MOD)) % (_MOD))
#define INF (1e9)
#define LINF (1e16)
#define EPS (1e-8)
#define PI (3.1415926535897932384626433832795)
#define y1 asdf_1
#define y0 asdf_2
#define j0 jj0
typedef unsigned long long ull;
typedef long double ldd;

using namespace std;

int n;
pair<int, int> pp[200010];
map<int, int> mapa;
int x[200010];
int w[200010];
int xw[200010];
int t[1000010];
int f[200010];

int maxa(int r)
{
    if (r < 0)
        return 0;
    int result = -2e9 - 10;
    for (; r >= 0; r = (r & (r + 1)) - 1)
        result = max(result, t[r]);
    return result;
}

void upd(int i, int val)
{
    for (; i < n; i = (i | (i + 1)))
        t[i] = max(t[i], val);
}

bool comp(pair<int, int> a, pair<int, int> b)
{
    return a.first + a.second < b.first + b.second;
}

int dyn(int k)
{
    if (k == 0)
        return 1;
    if (f[k] != -1)
        return f[k];
    int val = x[k] - w[k];
    int pos = upper_bound(xw, xw + n, val) - xw - 1;
    f[k] = maxa(pos) + 1;
    upd(mapa[x[k]], f[k]);
    return f[k];
}

int main()
{
    //freopen("input.txt", "w", stdout); testgen(200000, 200000, 200000); return 0;

    ios_base::sync_with_stdio(false); cin.tie(0);
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

    scanf("%d\n", &n);
    for (int i = 0; i < n; i++)
        scanf("%d %d\n", &pp[i].first, &pp[i].second);
    sort(pp, pp + n);
    for (int i = 0; i < n; i++)
    {
        x[i] = pp[i].first;
        w[i] = pp[i].second;
    }
    sort(pp, pp + n, comp);
    for (int i = 0; i < n; i++)
    {
        xw[i] = pp[i].first + pp[i].second;
        mapa[pp[i].first] = i;
        upd(i, 1);
    }

    memset(f, -1, sizeof f);
    int ans = 1;
    for (int i = 0; i < n; i++)
    {
        ans = max(ans, dyn(i));
    }
    printf("%d", ans);

    return 0;
}


#pragma comment(linker, "/STACK:256000000")
#define _USE_MATH_DEFINES
#define _CRT_NO_DEPRECEATE
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <memory.h>
#include <sstream>
#include <cassert>
#include <ctime>

#define pb push_back
#define ll long long
#define pll pair<ll, ll>
#define mp make_pair
#define sq(x) ((x)*(x))
#define tmin(x,y,z) (min(min((x),(y)),(z)))
#define _MOD 1000000009LL
#define MOD(x) (((x) + 2LL * (_MOD)) % (_MOD))
#define INF (1e9)
#define LINF (1e16)
#define EPS (1e-8)
#define PI (3.1415926535897932384626433832795)
#define y1 asdf_1
#define y0 asdf_2
#define j0 jj0
typedef unsigned long long ull;
typedef long double ldd;

using namespace std;

int n;
pair<int, int> pp[200010];
int x[200010];
int w[200010];
int f[200010];

int dyn(int k)
{
    if (f[k] != -1)
        return f[k];
    for (int i = k + 1; i < n; i++)
    {
        if (w[k] + w[i] <= x[i] - x[k])
            return f[k] = dyn(i) + 1;
    }
    return f[k] = 1;
}

int main()
{
    //freopen("input.txt", "w", stdout); testgen(200000, 200000, 200000); return 0;

    ios_base::sync_with_stdio(false); cin.tie(0);
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

    scanf("%d\n", &n);
    for (int i = 0; i < n; i++)
        scanf("%d %d\n", &pp[i].first, &pp[i].second);
    sort(pp, pp + n);
    for (int i = 0; i < n; i++)
    {
        x[i] = pp[i].first;
        w[i] = pp[i].second;
    }

    memset(f, -1, sizeof f);
    int ans = 1;
    for (int i = 0; i < n; i++)
    {
        ans = max(ans, dyn(i));
    }
    printf("%d", ans);

    return 0;
}


#pragma comment(linker, "/STACK:256000000")
#define _USE_MATH_DEFINES
#define _CRT_NO_DEPRECEATE
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <memory.h>
#include <sstream>
#include <cassert>
#include <ctime>

#define pb push_back
#define ll long long
#define pll pair<ll, ll>
#define mp make_pair
#define sq(x) ((x)*(x))
#define tmin(x,y,z) (min(min((x),(y)),(z)))
#define _MOD 1000000009LL
#define MOD(x) (((x) + 2LL * (_MOD)) % (_MOD))
#define INF (1e9)
#define LINF (1e16)
#define EPS (1e-8)
#define PI (3.1415926535897932384626433832795)
#define y1 asdf_1
#define y0 asdf_2
#define j0 jj0
typedef unsigned long long ull;
typedef long double ldd;

using namespace std;

int n;
pair<int, int> pp[200010];
int x[200010];
int w[200010];
int f[200010];

int dyn(int k)
{
    if (f[k] != -1)
        return f[k];
    f[k] = 1;
    for (int i = k + 1; i < n; i++)
    {
        if (w[k] + w[i] <= x[i] - x[k])
            f[k] = max(f[k], dyn(i) + 1);
    }
    return f[k];
}

int main()
{
    //freopen("input.txt", "w", stdout); testgen(200000, 200000, 200000); return 0;

    ios_base::sync_with_stdio(false); cin.tie(0);
   // freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

    scanf("%d\n", &n);
    for (int i = 0; i < n; i++)
        scanf("%d %d\n", &pp[i].first, &pp[i].second);
    sort(pp, pp + n);
    for (int i = 0; i < n; i++)
    {
        x[i] = pp[i].first;
        w[i] = pp[i].second;
    }

    memset(f, -1, sizeof f);
    int ans = 1;
    for (int i = 0; i < n; i++)
    {
        ans = max(ans, dyn(i));
    }
    printf("%d", ans);

    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:100000000")
#include <stdio.h>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <fstream>
#include <iostream>
#include <ctime>
using namespace std;
#define N 200100
#define M 1000000100
pair <int, int> p[N];
int v[N];
int main()
{
    int n, i, l, c, r, k;
    for(scanf("%d", &n), i=0; i<n; scanf("%d%d", &p[i].first, &p[i].second), i++);
    sort(p, p+n);
    v[0]=-2*M;
    k=0;
    for(i=0; i<n; i++)
    {
        for(l=0, r=k; l<r; )
        {
            c=(l+r+1)/2;
            if(p[i].first-p[i].second>=v[c]) l=c;
            else r=c-1;
        }
        if(r==k)
        {
            k++;
            v[k]=p[i].first+p[i].second;
        }
        else v[r+1]=min(v[r+1], p[i].first+p[i].second);
    }
    printf("%d\n", k);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <set>
#include <string>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;

const int MAX = 4e5 + 11;

int tree[4 * MAX];

int n;

vector <pair <int, int> > v;

map <int, int> mp;

int query(int v, int l, int r, int ql, int qr)
{
    if(ql == l && qr == r)
        return tree[v];
    if(r <= ql || l >= qr)
        return 0;
    int mid = (l + r) / 2;
    int left = query(2 * v + 1, l, mid, ql, min(qr, mid));
    int right = query(2 * v + 2, mid, r, max(ql, mid), qr);
    return left + right;
}

void update(int v, int l, int r, int d, int x)
{
    if(d >= r || d < l)
        return;
    if(l == r - 1)
    {
        tree[v] += x;
        return;
    }
    int mid = (l + r) / 2;
    update(2 * v + 1, l, mid, d, x);
    update(2 * v + 2, mid, r, d, x);
    tree[v] = tree[2 * v + 1] + tree[2 * v + 2];
}

int main()
{
    //freopen("input.in", "r", stdin);
    //freopen("output.out", "w", stdout);
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        int x, w;
        cin >> x >> w;
        v.push_back(make_pair(x - w, x + w));
        mp[x - w] = 0;
        mp[x + w] = 0;
    }
    int cur = 0;
    for(map <int, int>::iterator it = mp.begin(); it != mp.end(); it++)
        it->second = cur++;
    sort(v.begin(), v.end());
    int answer = -1;
    for(int i = 0; i < n; i++)
    {
        answer = max(answer, query(0, 0, MAX, mp[v[i].first], MAX) + 1);
        update(0, 0, MAX, mp[v[i].second], 1);
    }
    cout << answer;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <set>
#include <string>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;

const int MAX = 4e5 + 11;

int tree[4 * MAX];

int n;

vector <pair <int, int> > v;

/*bool cmp(pair <int, int> a, pair <int, int> b)
{
    return a.second < b.second || (b.second == a.second && a.first < b.first);
}*/

int main()
{
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        int x, w;
        cin >> x >> w;
        v.push_back(make_pair(x + w, x - w));
    }
    sort(v.begin(), v.end());
    int sum = 0;
    int gg = -1e9 - 1;
    for(int i = 0; i < n; i++)
    {
        if(v[i].second >= gg)
        {
            sum++;
            gg = v[i].first;
        }
    }
    cout << sum;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <set>
#include <string>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;

const int MAX = 4e5 + 11;

int tree[4 * MAX];

int n;

vector <pair <int, int> > v;

bool operator <(pair <int, int> a, pair <int, int> b)
{
    return a.second < b.second || (b.second == a.second && a.first < b.first);
}

int main()
{
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        int x, w;
        cin >> x >> w;
        v.push_back(make_pair(x - w, x + w));
    }
    sort(v.begin(), v.end());
    int sum = 0;
    int gg = -1e9 - 1;
    for(int i = 0; i < n; i++)
    {
        if(v[i].first >= gg)
        {
            sum++;
            gg = max(v[i].second, gg);
        }
    }
    cout << sum;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <set>
#include <string>
#include <map>
using namespace std;

int n;

map <int, int> mp;

set <pair<int, int> > st, ans;

int main()
{
    //freopen("input.in", "r", stdin);
    //freopen("output.out", "w", stdout);
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        int x, w;
        cin >> x >> w;
        st.insert(make_pair(x - w, x + w));
    }
    int answer = -1;
    for(set<pair<int, int> >::iterator it = st.begin(); it != st.end(); it++)
    {
        set<pair<int, int> >::iterator gg = ans.begin();
        while(ans.size() > 0 && ((*gg).first > (*it).second || (*gg).second < (*it).first))
        {
            set<pair<int, int> >::iterator er = gg;
            gg++;
            ans.erase(er);
        }
        ans.insert(*it);
        answer = max(answer, (int)ans.size());
    }
    /*int ans = 0;
    for(map<int, int>::iterator it = mp.begin(); it != mp.end(); it++)
    {
        ans += it->second;
        answer = max(ans, answer);
    }*/
    cout << answer;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <set>
#include <string>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;

const int MAX = 4e5 + 11;

int tree[4 * MAX];

int n;

vector <pair <int, int> > v;

bool cmp(pair <int, int> a, pair <int, int> b)
{
    return a.second < b.second || (b.second == a.second && a.first < b.first);
}

int main()
{
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        int x, w;
        cin >> x >> w;
        v.push_back(make_pair(x - w, x + w));
    }
    sort(v.begin(), v.end());
    int sum = 0;
    int gg = -1e9 - 1;
    for(int i = 0; i < n; i++)
    {
        if(v[i].first >= gg)
        {
            sum++;
            gg = max(v[i].second, gg);
        }
    }
    cout << sum;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <set>
#include <string>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;

const int MAX = 2e5 + 11;

int tree[4 * MAX];

int n;

vector <pair <int, int> > v;

map <int, int> mp;

int query(int v, int l, int r, int ql, int qr)
{
    if(ql == l && qr == r)
        return tree[v];
    if(r <= ql || l >= qr)
        return 0;
    int mid = (l + r) / 2;
    int left = query(2 * v + 1, l, mid, ql, min(qr, mid));
    int right = query(2 * v + 2, mid, r, max(ql, mid), qr);
    return left + right;
}

void update(int v, int l, int r, int d, int x)
{
    if(d >= r || d < l)
        return;
    if(l == r - 1)
    {
        tree[v] += x;
        return;
    }
    int mid = (l + r) / 2;
    update(2 * v + 1, l, mid, d, x);
    update(2 * v + 2, mid, r, d, x);
    tree[v] = tree[2 * v + 1] + tree[2 * v + 2];
}

int main()
{
    //freopen("input.in", "r", stdin);
    //freopen("output.out", "w", stdout);
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        int x, w;
        cin >> x >> w;
        v.push_back(make_pair(x - w, x + w));
        mp[x - w] = 0;
        mp[x + w] = 0;
    }
    int cur = 0;
    for(map <int, int>::iterator it = mp.begin(); it != mp.end(); it++)
    {
        it->second = cur++;
    }
    sort(v.begin(), v.end());
    int answer = -1;
    for(int i = 0; i < n; i++)
    {
        answer = max(answer, i + 1 - query(0, 0, MAX, 0, mp[v[i].first]));
        update(0, 0, MAX, mp[v[i].second], 1);
    }
    /*int ans = 0;
    for(map<int, int>::iterator it = mp.begin(); it != mp.end(); it++)
    {
        ans += it->second;
        answer = max(ans, answer);
    }*/
    cout << answer;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <set>
#include <string>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;

const int MAX = 4e5 + 11;

int tree[4 * MAX];

int n;

vector <pair <int, int> > v;

int main()
{
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        int x, w;
        cin >> x >> w;
        v.push_back(make_pair(x - w, x + w));
    }
    sort(v.begin(), v.end());
    int sum = 0;
    int gg = -1e9 - 1;
    for(int i = 0; i < n; i++)
    {
        if(v[i].first >= gg)
        {
            sum++;
            gg = max(v[i].second, gg);
        }
    }
    cout << sum;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <set>
#include <string>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;

const int MAX = 4e5 + 11;

int tree[4 * MAX];

int n;

vector <pair <int, int> > v;

bool cmp(pair <int, int> a, pair <int, int> b)
{
    return b.second < a.second || (b.second == a.second && b.first < a.first);
}

int main()
{
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        int x, w;
        cin >> x >> w;
        v.push_back(make_pair(x - w, x + w));
    }
    sort(v.begin(), v.end());
    int sum = 0;
    int gg = -1e9 - 1;
    for(int i = 0; i < n; i++)
    {
        if(v[i].first >= gg)
        {
            sum++;
            gg = max(v[i].second, gg);
        }
    }
    cout << sum;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <set>
#include <string>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;

const int MAX = 4e5 + 11;

int tree[4 * MAX];

int n;

vector <pair <int, int> > v;

/*bool cmp(pair <int, int> a, pair <int, int> b)
{
    return a.second < b.second || (b.second == a.second && a.first < b.first);
}*/

int main()
{
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        int x, w;
        cin >> x >> w;
        v.push_back(make_pair(x + w, x - w));
    }
    sort(v.begin(), v.end());
    int sum = 0;
    int gg = -1e9 - 1;
    for(int i = 0; i < n; i++)
    {
        if(v[i].second >= gg)
        {
            sum++;
            gg = max(v[i].first, gg);
        }
    }
    cout << sum;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <set>
#include <string>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;

const int MAX = 2e5 + 11;

int tree[4 * MAX];

int n;

vector <pair <int, int> > v;

map <int, int> mp;

int query(int v, int l, int r, int ql, int qr)
{
    if(ql == l && qr == r)
        return tree[v];
    if(r <= ql || l >= qr)
        return 0;
    int mid = (l + r) / 2;
    int left = query(2 * v + 1, l, mid, ql, min(qr, mid));
    int right = query(2 * v + 2, mid, r, max(ql, mid), qr);
    return left + right;
}

void update(int v, int l, int r, int d, int x)
{
    if(d >= r || d < l)
        return;
    if(l == r - 1)
    {
        tree[v] = x;
        return;
    }
    int mid = (l + r) / 2;
    update(2 * v + 1, l, mid, d, x);
    update(2 * v + 2, mid, r, d, x);
    tree[v] = tree[2 * v + 1] + tree[2 * v + 2];
}

int main()
{
    //freopen("input.in", "r", stdin);
    //freopen("output.out", "w", stdout);
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        int x, w;
        cin >> x >> w;
        v.push_back(make_pair(x - w, x + w));
        mp[x - w] = 0;
        mp[x + w] = 0;
    }
    int cur = 0;
    for(map <int, int>::iterator it = mp.begin(); it != mp.end(); it++)
    {
        it->second = cur++;
    }
    sort(v.begin(), v.end());
    int answer = -1;
    for(int i = 0; i < n; i++)
    {
        answer = max(answer, i + 1 - query(0, 0, MAX, 0, mp[v[i].first]));
        update(0, 0, MAX, mp[v[i].second], 1);
    }
    /*int ans = 0;
    for(map<int, int>::iterator it = mp.begin(); it != mp.end(); it++)
    {
        ans += it->second;
        answer = max(ans, answer);
    }*/
    cout << answer;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <set>
#include <string>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;

const int MAX = 2e5 + 11;

int tree[4 * MAX];

int n;

vector <pair <int, int> > v;

int query(int v, int l, int r, int ql, int qr)
{
    if(ql == l && qr == r)
        return tree[v];
    if(r <= ql || l >= qr)
        return 0;
    int mid = (l + r) / 2;
    int left = query(2 * v + 1, l, mid, ql, min(qr, mid));
    int right = query(2 * v + 2, mid, r, max(ql, mid), qr);
    return left + right;
}

void update(int v, int l, int r, int d, int x)
{
    if(d >= r || d < l)
        return;
    if(l == r - 1)
    {
        tree[v] = x;
        return;
    }
    int mid = (l + r) / 2;
    update(2 * v + 1, l, mid, d, x);
    update(2 * v + 2, mid, r, d, x);
    tree[v] = tree[2 * v + 1] + tree[2 * v + 2];
}

int main()
{
    //freopen("input.in", "r", stdin);
    //freopen("output.out", "w", stdout);
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        int x, w;
        cin >> x >> w;
        v.push_back(make_pair(x - w, x + w));
    }
    sort(v.begin(), v.end());
    int answer = -1;
    for(int i = 0; i < n; i++)
    {
        answer = max(answer, i + 1 - query(0, 0, MAX, 0, v[i].first));
        update(0, 0, MAX, v[i].second, 1);
    }
    /*int ans = 0;
    for(map<int, int>::iterator it = mp.begin(); it != mp.end(); it++)
    {
        ans += it->second;
        answer = max(ans, answer);
    }*/
    cout << answer;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <set>
#include <string>
#include <map>
using namespace std;

int n;

map <int, int> mp;

int main()
{
    //freopen("input.in", "r", stdin);
    //freopen("output.out", "w", stdout);
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        int x, w;
        cin >> x >> w;
        mp[x - w]++;
        mp[x + w + 1]--;
    }
    int answer = -1;
    int ans = 0;
    for(map<int, int>::iterator it = mp.begin(); it != mp.end(); it++)
    {
        ans += it->second;
        answer = max(ans, answer);
    }
    cout << answer;
    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
#include <set>
#include <cmath>
#include <ctime>
#include <stack>
#include <fstream>
#include <array>
#include <queue>
#include <map>
#include <list>

using namespace std;

struct node
{
    node* L, *R;
    unsigned int val;
    unsigned int keep;
    node()
    {
        L = NULL;
        R = NULL;
        val = 0;
        keep = 0;
    }
};

unsigned int A, B;
unsigned int X;

void create(node* i, unsigned int l, unsigned int r)
{
    i->L = new node();
    i->R = new node();
}

void push(node *i, const unsigned int l, const unsigned int r)
{
    i->L->val += i->keep;
    i->R->val += i->keep;
    i->L->keep += i->keep;
    i->R->keep += i->keep;
    i->keep = 0;
}

void add(node* i, const unsigned int l, const unsigned int r)
{
    if (r < A || l > B) return;
    if (r <= B && l >= A)
    {
        i->val += X;
        i->keep += X;
        return;
    }
    if (i->L == NULL)
        create(i, l, r);
    push(i, l, r);
    add(i->L, l, (l + r) / 2);
    add(i->R, (l + r) / 2 + 1, r);
    i->val = max(i->L->val, i->R->val);
}

const unsigned int get(node* i, const unsigned int l, const unsigned int r)
{
    if (r < A || l > B) return 0;

    if (r <= B && l >= A)
        return i->val;
    if (i->L == NULL)
        create(i, l, r);
    push(i, l, r);
    return max(get(i->L, l, (l + r) / 2), get(i->R, (l + r) / 2 + 1, r));
}

pair <unsigned int, unsigned int> q[200000];

int main()
{
    int n;
    scanf("%d", &n);
    node* root = new node();
    for (int i = 0; i < n; i++)
        scanf("%d %d", &q[i].first, &q[i].second);
    unsigned int k2 = 1<<30;
    k2 *= 2;
    k2 = k2 + 5;
    sort(q, q + n);
    for (int i = 0; i < n; i++)
    {
        A = 0;
        X = 0;
        if (q[i].first > q[i].second)
        {
            B = q[i].first - q[i].second;
            if (B >= 0)
                X = get(root, 0, k2 - 1);
        }
        A = q[i].first + q[i].second;
        B = q[i].first + q[i].second;
        int y = get(root, 0, k2 - 1);
        X = X + 1 - y;
        add(root, 0, k2 - 1);
    }
    cout << root->val;
    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
#include <set>
#include <cmath>
#include <ctime>
#include <stack>
#include <fstream>
#include <array>
#include <queue>
#include <map>
#include <list>

using namespace std;

struct node
{
    node* L, *R;
    unsigned int val;
    unsigned int keep;
    node()
    {
        L = NULL;
        R = NULL;
        val = 0;
        keep = 0;
    }
};

unsigned int A, B;
unsigned int X;

void create(node* i, unsigned int l, unsigned int r)
{
    i->L = new node();
    i->R = new node();
}

void push(node *i, const unsigned int l, const unsigned int r)
{
    i->L->val += i->keep;
    i->R->val += i->keep;
    i->L->keep += i->keep;
    i->R->keep += i->keep;
    i->keep = 0;
}

void add(node* i, const unsigned int l, const unsigned int r)
{
    if (r < A || l > B) return;
    if (r <= B && l >= A)
    {
        i->val += X;
        i->keep += X;
        return;
    }
    if (i->L == NULL)
        create(i, l, r);
    push(i, l, r);
    add(i->L, l, (l + r) / 2);
    add(i->R, (l + r) / 2 + 1, r);
    i->val = max(i->L->val, i->R->val);
}

const unsigned int get(node* i, const unsigned int l, const unsigned int r)
{
    if (r < A || l > B) return 0;

    if (r <= B && l >= A)
        return i->val;
    if (i->L == NULL)
        create(i, l, r);
    push(i, l, r);
    return max(get(i->L, l, (l + r) / 2), get(i->R, (l + r) / 2 + 1, r));
}

pair <unsigned int, unsigned int> q[200000];

int main()
{
    int n;
    scanf("%d", &n);
    node* root = new node();
    for (int i = 0; i < n; i++)
        scanf("%d %d", &q[i].first, &q[i].second);
    unsigned int k2 = 1<<30;
    k2 *= 2;
    k2--;
    k2 *= 2;
    sort(q, q + n);
    for (int i = 0; i < n; i++)
    {
        A = 0;
        X = 0;
        if (q[i].first > q[i].second)
        {
            B = q[i].first - q[i].second;
            if (B >= 0)
                X = get(root, 0, k2 - 1);
        }
        A = q[i].first + q[i].second;
        B = q[i].first + q[i].second;
        int y = get(root, 0, k2 - 1);
        X = X + 1 - y;
        add(root, 0, k2 - 1);
    }
    cout << root->val;
    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
#include <set>
#include <cmath>
#include <ctime>
#include <stack>
#include <fstream>
#include <array>
#include <queue>
#include <map>
#include <list>

using namespace std;

struct node
{
    node* L, *R;
    unsigned int val;
    unsigned int keep;
    node()
    {
        L = NULL;
        R = NULL;
        val = 0;
        keep = 0;
    }
};

unsigned int A, B;
unsigned int X;

void create(node* i)
{
    i->L = new node();
    i->R = new node();
}

void push(node *i, const unsigned int l, const unsigned int r)
{
    i->L->val += i->keep;
    i->R->val += i->keep;
    i->L->keep += i->keep;
    i->R->keep += i->keep;
    i->keep = 0;
}

void add(node* i, const unsigned int l, const unsigned int r)
{
    if (r < A || l > B) return;
    if (r <= B && l >= A)
    {
        i->val += X;
        i->keep += X;
        return;
    }
    if (i->L == NULL)
        create(i);
    push(i, l, r);
    add(i->L, l, (l + r) / 2);
    add(i->R, (l + r) / 2 + 1, r);
    i->val = max(i->L->val, i->R->val);
}

const unsigned int get(node* i, const unsigned int l, const unsigned int r)
{
    if (r < A || l > B) return 0;

    if (r <= B && l >= A)
        return i->val;
    if (i->L == NULL)
        create(i, l, r);
    push(i, l, r);
    return max(get(i->L, l, (l + r) / 2), get(i->R, (l + r) / 2 + 1, r));
}

pair <unsigned int, unsigned int> q[200000];

int main()
{
    int n;
    scanf("%d", &n);
    node* root = new node();
    for (int i = 0; i < n; i++)
        scanf("%d %d", &q[i].first, &q[i].second);
    unsigned int k2 = 1 << 30;
    k2 *= 2;
    k2 = k2 + 5;
    sort(q, q + n);
    for (int i = 0; i < n; i++)
    {
        A = 0;
        X = 0;
        if (q[i].first > q[i].second)
        {
            B = q[i].first - q[i].second;
            if (B >= 0)
                X = get(root, 0, k2 - 1);
        }
        A = q[i].first + q[i].second;
        B = q[i].first + q[i].second;
        int y = get(root, 0, k2 - 1);
        X = X + 1 - y;
        add(root, 0, k2 - 1);
    }
    cout << root->val;
    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
#include <set>
#include <cmath>
#include <ctime>
#include <stack>
#include <fstream>
#include <array>
#include <queue>
#include <map>
#include <list>

using namespace std;

struct node
{
    node* L, *R;
    long long val;
    long long keep;
    node()
    {
        L = NULL;
        R = NULL;
        val = 0;
        keep = 0;
    }
};

long long A, B;
long long X;

void create(node* i, long long l, long long r)
{
    i->L = new node();
    i->R = new node();
}

void push(node *i, long long l, long long r)
{
    i->L->val += i->keep;
    i->R->val += i->keep;
    i->L->keep += i->keep;
    i->R->keep += i->keep;
    i->keep = 0;
}

void add(node* i, long long l, long long r)
{
    if (r < A || l > B) return;
    if (r <= B && l >= A)
    {
        i->val += X;
        i->keep += X;
        return;
    }
    if (i->L == NULL)
        create(i, l, r);
    push(i, l, r);
    add(i->L, l, (l + r) / 2);
    add(i->R, (l + r) / 2 + 1, r);
    i->val = max(i->L->val, i->R->val);
}

long long get(node* i, long long l, long long r)
{
    if (r < A || l > B) return 0;

    if (r <= B && l >= A)
        return i->val;
    if (i->L == NULL)
        create(i, l, r);
    push(i, l, r);
    return max(get(i->L, l, (l + r) / 2), get(i->R, (l + r) / 2 + 1, r));
}

pair <long long, long long> q[200000];

int main()
{
    int n;
    scanf("%d", &n);
    node* root = new node();
    for (int i = 0; i < n; i++)
        scanf("%I64d %I64d", &q[i].first, &q[i].second);
    long long k2 = 1LL << 32;
    sort(q, q + n);
    for (int i = 0; i < n; i++)
    {
        A = 0;
        B = q[i].first- q[i].second;
        X = 0;
        if (B >= 0)
            X = get(root, 0, k2 - 1);
        A = q[i].first + q[i].second;
        B = q[i].first + q[i].second;
        X++;
        add(root, 0, k2 - 1);
    }
    cout << root->val;
    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
#include <set>
#include <cmath>
#include <ctime>
#include <stack>
#include <fstream>
#include <array>
#include <queue>
#include <map>
#include <list>

using namespace std;

struct node
{
    node* L, *R;
    long long val;
    long long keep;
    node()
    {
        L = NULL;
        R = NULL;
        val = 0;
        keep = 0;
    }
};

long long A, B;
long long X;

void create(node* i, long long l, long long r)
{
    i->L = new node();
    i->R = new node();
}

void push(node *i, long long l, long long r)
{
    i->L->val += i->keep;
    i->R->val += i->keep;
    i->L->keep += i->keep;
    i->R->keep += i->keep;
    i->keep = 0;
}

void add(node* i, long long l, long long r)
{
    if (r < A || l > B) return;
    if (r <= B && l >= A)
    {
        i->val += X;
        i->keep += X;
        return;
    }
    if (i->L == NULL)
        create(i, l, r);
    push(i, l, r);
    add(i->L, l, (l + r) / 2);
    add(i->R, (l + r) / 2 + 1, r);
    i->val = max(i->L->val, i->R->val);
}

long long get(node* i, long long l, long long r)
{
    if (r < A || l > B) return 0;

    if (r <= B && l >= A)
        return i->val;
    if (i->L == NULL)
        create(i, l, r);
    push(i, l, r);
    return max(get(i->L, l, (l + r) / 2), get(i->R, (l + r) / 2 + 1, r));
}

pair <long long, long long> q[200000];

int main()
{
    int n;
    scanf("%d", &n);
    node* root = new node();
    for (int i = 0; i < n; i++)
        scanf("%I64d %I64d", &q[i].first, &q[i].second);
    long long k2 = 1LL << 40;
    sort(q, q + n);
    for (int i = 0; i < n; i++)
    {
        A = 0;
        B = q[i].first- q[i].second;
        X = 0;
        if (B >= 0)
            X = get(root, 0, k2 - 1);
        A = q[i].first + q[i].second;
        B = q[i].first + q[i].second;
        int y = get(root, 0, k2 - 1);
        X = X + 1 - y;
        add(root, 0, k2 - 1);
    }
    cout << root->val;
    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
#include <set>
#include <cmath>
#include <ctime>
#include <stack>
#include <fstream>
#include <array>
#include <queue>
#include <map>
#include <list>

using namespace std;

struct node
{
    node* L, *R;
    unsigned int val;
    unsigned int keep;
    node()
    {
        L = NULL;
        R = NULL;
        val = 0;
        keep = 0;
    }
};

unsigned int A, B;
unsigned int X;

inline void create(node* i)
{
    i->L = new node();
    i->R = new node();
}

inline void push(node *i)
{
    i->L->val += i->keep;
    i->R->val += i->keep;
    i->L->keep += i->keep;
    i->R->keep += i->keep;
    i->keep = 0;
}

void add(node* i, const unsigned int l, const unsigned int r)
{
    if (r < A || l > B) return;
    if (r <= B && l >= A)
    {
        i->val += X;
        i->keep += X;
        return;
    }
    if (i->L == NULL)
        create(i);
    push(i);
    add(i->L, l, (l + r) / 2);
    add(i->R, (l + r) / 2 + 1, r);
    i->val = max(i->L->val, i->R->val);
}

const unsigned int get(node* i, const unsigned int l, const unsigned int r)
{
    if (r < A || l > B) return 0;

    if (r <= B && l >= A)
        return i->val;
    if (i->L == NULL)
        create(i);
    push(i);
    return max(get(i->L, l, (l + r) / 2), get(i->R, (l + r) / 2 + 1, r));
}

pair <unsigned int, unsigned int> q[200000];

int main()
{
    int n;
    scanf("%d", &n);
    node* root = new node();
    for (int i = 0; i < n; i++)
        scanf("%d %d", &q[i].first, &q[i].second);
    unsigned int k2 = 1 << 30;
    k2 *= 2;
    k2 = k2 + 5;
    sort(q, q + n);
    for (int i = 0; i < n; i++)
    {
        A = 0;
        X = 0;
        if (q[i].first > q[i].second)
        {
            B = q[i].first - q[i].second;
            if (B >= 0)
                X = get(root, 0, k2 - 1);
        }
        A = q[i].first + q[i].second;
        B = q[i].first + q[i].second;
        int y = get(root, 0, k2 - 1);
        X = X + 1 - y;
        add(root, 0, k2 - 1);
    }
    cout << root->val;
    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
#include <set>
#include <cmath>
#include <ctime>
#include <stack>
#include <fstream>
#include <array>
#include <queue>
#include <map>
#include <list>

using namespace std;

struct node
{
    node* L, *R;
    unsigned int val;
    unsigned int keep;
    node()
    {
        L = NULL;
        R = NULL;
        val = 0;
        keep = 0;
    }
};

unsigned int A, B;
unsigned int X;

void create(node* i)
{
    i->L = new node();
    i->R = new node();
}

void push(node *i, const unsigned int l, const unsigned int r)
{
    i->L->val += i->keep;
    i->R->val += i->keep;
    i->L->keep += i->keep;
    i->R->keep += i->keep;
    i->keep = 0;
}

void add(node* i, const unsigned int l, const unsigned int r)
{
    if (r < A || l > B) return;
    if (r <= B && l >= A)
    {
        i->val += X;
        i->keep += X;
        return;
    }
    if (i->L == NULL)
        create(i);
    push(i, l, r);
    add(i->L, l, (l + r) / 2);
    add(i->R, (l + r) / 2 + 1, r);
    i->val = max(i->L->val, i->R->val);
}

const unsigned int get(node* i, const unsigned int l, const unsigned int r)
{
    if (r < A || l > B) return 0;

    if (r <= B && l >= A)
        return i->val;
    if (i->L == NULL)
        create(i);
    push(i, l, r);
    return max(get(i->L, l, (l + r) / 2), get(i->R, (l + r) / 2 + 1, r));
}

pair <unsigned int, unsigned int> q[200000];

int main()
{
    int n;
    scanf("%d", &n);
    node* root = new node();
    for (int i = 0; i < n; i++)
        scanf("%d %d", &q[i].first, &q[i].second);
    unsigned int k2 = 1 << 30;
    k2 *= 2;
    k2 = k2 + 5;
    sort(q, q + n);
    for (int i = 0; i < n; i++)
    {
        A = 0;
        X = 0;
        if (q[i].first > q[i].second)
        {
            B = q[i].first - q[i].second;
            if (B >= 0)
                X = get(root, 0, k2 - 1);
        }
        A = q[i].first + q[i].second;
        B = q[i].first + q[i].second;
        int y = get(root, 0, k2 - 1);
        X = X + 1 - y;
        add(root, 0, k2 - 1);
    }
    cout << root->val;
    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
#include <set>
#include <cmath>
#include <ctime>
#include <stack>
#include <fstream>
#include <array>
#include <queue>
#include <map>
#include <list>

using namespace std;

struct node
{
    node* L, *R;
    long long val;
    long long keep;
    node()
    {
        L = NULL;
        R = NULL;
        val = 0;
        keep = 0;
    }
};

long long A, B;
long long X;

void create(node* i, long long l, long long r)
{
    i->L = new node();
    i->R = new node();
}

void push(node *i, long long l, long long r)
{
    i->L->val += i->keep;
    i->R->val += i->keep;
    i->L->keep += i->keep;
    i->R->keep += i->keep;
    i->keep = 0;
}

void add(node* i, long long l, long long r)
{
    if (r < A || l > B) return;
    if (r <= B && l >= A)
    {
        i->val += X;
        i->keep += X;
        return;
    }
    if (i->L == NULL)
        create(i, l, r);
    push(i, l, r);
    add(i->L, l, (l + r) / 2);
    add(i->R, (l + r) / 2 + 1, r);
    i->val = max(i->L->val, i->R->val);
}

long long get(node* i, long long l, long long r)
{
    if (r < A || l > B) return 0;

    if (r <= B && l >= A)
        return i->val;
    if (i->L == NULL)
        create(i, l, r);
    push(i, l, r);
    return max(get(i->L, l, (l + r) / 2), get(i->R, (l + r) / 2 + 1, r));
}

pair <long long, long long> q[200000];

int main()
{
    int n;
    scanf("%d", &n);
    node* root = new node();
    for (int i = 0; i < n; i++)
        scanf("%I64d %I64d", &q[i].first, &q[i].second);
    long long k2 = 1LL << 32;
    sort(q, q + n);
    for (int i = 0; i < n; i++)
    {
        A = 0;
        B = q[i].first- q[i].second;
        X = 0;
        if (B >= 0)
            X = get(root, 0, k2 - 1);
        A = q[i].first + q[i].second;
        B = q[i].first + q[i].second;
        int y = get(root, 0, k2 - 1);
        X = X + 1 - y;
        add(root, 0, k2 - 1);
    }
    cout << root->val;
    return 0;
}


#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_DEPRECATE
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <utility>
#include <algorithm>
#include <memory.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>

using namespace std;

#define pb push_back
#define pii pair<int, int>
#define pdi pair<double, int>
#define pdii pair<pdi, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define inf 2000000000
#define mod 1000000007
#define y1 uhgeg
#define lim 31700
#define eps 1e-9
#define prime 3001

typedef long long ll;
typedef unsigned long long ull;

struct treap
{
	int l, r, max, d, x, y;
};

int n, m, j, i, h, g, l, k, q1, q2, q, x, der, ans;
treap t[200500];
pii p[200500];

void update(int q)
{
	t[q].max = t[q].d;
	t[q].max = max(t[q].max, t[t[q].l].max);
	t[q].max = max(t[q].max, t[t[q].r].max);
}

pii split(int q, int x)
{
	if (!q)
	{
		return pii(0, 0);
	}
	pii p;
	if (t[q].x <= x)
	{
		p = split(t[q].r, x);
		t[q].r = p.first;
		p.first = q;
	}
	else
	{
		p = split(t[q].l, x);
		t[q].l = p.second;
		p.second = q;
	}
	update(q);
	return p;
}

int merge(int q1, int q2)
{
	if (!q1 || !q2)
	{
		return max(q1, q2);
	}
	if (t[q1].y < t[q2].y)
	{
		t[q1].r = merge(t[q1].r, q2);
		update(q1);
		return q1;
	}
	else
	{
		t[q2].l = merge(q1, t[q2].l);
		update(q2);
		return q2;
	}
}

int get_max(int q, int x)
{
	if (!q)
	{
		return 0;
	}
	if (t[q].x >= x)
	{
		int res = max(t[t[q].r].max, t[q].d);
		return max(res, get_max(t[q].l, x));
	}
	else
	{
		return get_max(t[q].r, x);
	}
}

void add(int num)
{
	pii p = split(der, t[num].x);
	der = merge(merge(p.first, num), p.second);
}

void solve()
{
	scanf ("%d", &n);
	for (j = 1; j <= n; j++)
	{
		scanf ("%d%d", &p[j].first, &p[j].second);
	}
	sort (p + 1, p + n + 1);
	for (j = n; j >= 1; j--)
	{
		t[j].max = t[j].d = 1 + get_max(der, p[j].first + p[j].second);
		t[j].x = p[j].first - p[j].second;
		t[j].y = rand();
		add(j);
		ans = max(t[j].d, ans);
	}
	printf ("%d\n", ans);
}

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);
	//freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout);
	srand(333);
	solve();
	return 0;
}


#define _USE_MATH_DEFINES
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <climits>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <functional>

#define mp make_pair
#define mt(x,y,z) mp((x),mp((y),(z)))
#define ZERO(x) memset((x), 0, sizeof(x))
#define NEGATE(x) memset((x), 255, sizeof(x))
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;

// globals starts here

const int MAXN = 200050;
bool q[MAXN];

int main()
{
#ifdef DEBUGAGA
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#elif defined(CONTEST)
    freopen(CONTEST ".in", "r", stdin);
    freopen(CONTEST ".out", "w", stdout);
#endif

    int n;
    cin >> n;
    priority_queue<iii, vector<iii>, greater<iii>> pts;
    stack<int> cur_pts;
    ZERO(q);

    for (int i = 0; i < n; ++i)
    {
        int x, w;
        cin >> x >> w;
        pts.push(mt(x - w + 1, 0, i));
        pts.push(mt(x + w, 1, i));
    }

    int ans = 0;
    while (!pts.empty())
    {
        iii cur = pts.top();
        pts.pop();

        if (cur.second.first == 0)
        {
            cur_pts.push(cur.second.second);
        }
        else
        {
            if (!q[cur.second.second])
            {
                ++ans;
                q[cur.second.second] = true;
                while (!cur_pts.empty())
                {
                    int pt = cur_pts.top();
                    cur_pts.pop();
                    q[pt] = true;
                }
            }
        }
    }

    cout << ans;

    return 0;
}


#define _USE_MATH_DEFINES
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <climits>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <functional>

#define mp make_pair
#define mt(x,y,z) mp((x),mp((y),(z)))
#define ZERO(x) memset((x), 0, sizeof(x))
#define NEGATE(x) memset((x), 255, sizeof(x))
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;

// globals starts here

const int MAXN = 200050;
bool q[MAXN];

int main()
{
#ifdef DEBUGAGA
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#elif defined(CONTEST)
    freopen(CONTEST ".in", "r", stdin);
    freopen(CONTEST ".out", "w", stdout);
#endif

    int n;
    cin >> n;
    priority_queue<iii, vector<iii>, greater<iii>> pts;
    stack<int> cur_pts;
    ZERO(q);

    for (int i = 0; i < n; ++i)
    {
        int x, w;
        cin >> x >> w;
        pts.push(mt(x - w + 1, 0, i));
        pts.push(mt(x + w - 1, 1, i));
    }

    int ans = 0;
    while (!pts.empty())
    {
        iii cur = pts.top();
        pts.pop();

        if (cur.second.first == 0)
        {
            cur_pts.push(cur.second.second);
        }
        else
        {
            if (!q[cur.second.second])
            {
                ++ans;
                q[cur.second.second] = true;
                while (!cur_pts.empty())
                {
                    int pt = cur_pts.top();
                    cur_pts.pop();
                    q[pt] = true;
                }
            }
        }
    }

    cout << ans;

    return 0;
}


#define _USE_MATH_DEFINES
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <climits>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <functional>

#define mp make_pair
#define mt(x,y,z) mp((x),mp((y),(z)))
#define ZERO(x) memset((x), 0, sizeof(x))
#define NEGATE(x) memset((x), 255, sizeof(x))
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;

// globals starts here

const int MAXN = 200050;
bool q[MAXN];

int main()
{
#ifdef DEBUGAGA
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#elif defined(CONTEST)
    freopen(CONTEST ".in", "r", stdin);
    freopen(CONTEST ".out", "w", stdout);
#endif

    int n;
    cin >> n;
    priority_queue<iii, vector<iii>, greater<iii>> pts;
    stack<int> cur_pts;
    ZERO(q);

    for (int i = 0; i < n; ++i)
    {
        int x, w;
        cin >> x >> w;
        pts.push(mt(x - w + 1, 1, i));
        pts.push(mt(x + w - 1, 0, i));
    }

    int ans = 0;
    while (!pts.empty())
    {
        iii cur = pts.top();
        pts.pop();

        if (cur.second.first == 0)
        {
            cur_pts.push(cur.second.second);
        }
        else
        {
            if (!q[cur.second.second])
            {
                ++ans;
                q[cur.second.second] = true;
                while (!cur_pts.empty())
                {
                    int pt = cur_pts.top();
                    cur_pts.pop();
                    q[pt] = true;
                }
            }
        }
    }

    cout << ans;

    return 0;
}


#include <iostream>
#include <iomanip>
#include <sstream>
#include <stdint.h>
#include <string.h>

#include <unordered_set>
#include <unordered_map>

#include <vector>
#include <list>

#include <set>
#include <map>

#include <string>
#include <vector>
#include <queue>

#include <algorithm>

typedef uint8_t u8;
typedef int8_t i8;

typedef uint32_t u32;
typedef int32_t i32;

typedef uint64_t u64;
typedef int64_t i64;

#define sqr(x) x*x

#define INF 2000000000
#define MOD 1000000007

using namespace std;

struct less_key
{
    bool operator() (const pair<u32, u32>& p1, const pair<u32, u32>& p2)
    {
        return p1.first < p2.first || (p1.first == p2.first && p1.second < p2.second);
    }
};

u32 n;

pair<i32, i32> a[200002];
multimap<i32, pair<u32, bool> > e;

vector<pair<i32, i32> > r;

u32 R[200002];

int main() {
    cin >> n;

    for (u32 i = 0; i < n; i++) {
        i32 x, w;
        cin >> x >> w;
        a[i] = make_pair(x - w, x + w);
        e.insert(make_pair(x - w, make_pair(i, false)));
        e.insert(make_pair(x + w, make_pair(i, true)));
    }

    set<u32> f;
    map<i32, u32> p;

    for (auto it = e.begin(); it != e.end(); it++) {
        if (!it->second.second) {
            f.insert(it->second.first);
            p.insert(make_pair(it->first, it->second.first));
        }
        else {
            if (f.find(it->second.first) == f.end()) {
                continue;
            }

            r.push_back(a[it->second.first]);
            auto eit = p.begin();
            while (eit != p.end()) {
                if (eit->first <= a[it->second.first].first) {
                    f.erase(eit->second);
                    p.erase(eit++);
                }
                else {
                    break;
                }
            }
        }
    }

    for (i32 i = r.size() - 1; i >= 0; i--) {
        u32 e = lower_bound(r.begin() + i, r.begin() + r.size(), make_pair(r[i].second, 0)) - r.begin();
        R[i] = max(R[i + 1], R[e] + 1);
    }

    //for (i32 i = 0; i < r.size(); i++) {
    //    cout << R[i] << " ";
    //}

    cout << R[0] << endl;

    //for (auto it = r.begin(); it != r.end(); it++) {
    //    cout << it->first << ";" << it->second << endl;
    //}

    return 0;
}


#include <iostream>
#include <iomanip>
#include <sstream>
#include <stdint.h>
#include <string.h>

#include <unordered_set>
#include <unordered_map>

#include <vector>
#include <list>

#include <set>
#include <map>

#include <string>
#include <vector>
#include <queue>

#include <algorithm>

typedef uint8_t u8;
typedef int8_t i8;

typedef uint32_t u32;
typedef int32_t i32;

typedef uint64_t u64;
typedef int64_t i64;

#define sqr(x) x*x

#define INF 2000000000
#define MOD 1000000007

using namespace std;

struct less_key
{
    bool operator() (const pair<u32, u32>& p1, const pair<u32, u32>& p2)
    {
        return p1.first < p2.first || (p1.first == p2.first && p1.second < p2.second);
    }
};

u32 n;

pair<i32, i32> a[200002];
multimap<i32, pair<u32, bool> > e;

vector<pair<i32, i32> > r;

u32 R[200002];

int main() {
    cin >> n;

    for (u32 i = 0; i < n; i++) {
        i32 x, w;
        cin >> x >> w;
        a[i] = make_pair(x - w, x + w);
        e.insert(make_pair(x - w, make_pair(i, false)));
        e.insert(make_pair(x + w, make_pair(i, true)));
    }

    set<u32> f;
    multimap<i32, u32> p;

    for (auto it = e.begin(); it != e.end(); it++) {
        if (!it->second.second) {
            f.insert(it->second.first);
            p.insert(make_pair(it->first, it->second.first));
        }
        else {
            if (f.find(it->second.first) == f.end()) {
                continue;
            }

            r.push_back(a[it->second.first]);
            auto eit = p.begin();
            while (eit != p.end()) {
                if (eit->first <= a[it->second.first].first) {
                    f.erase(eit->second);
                    p.erase(eit++);
                }
                else {
                    break;
                }
            }
        }
    }

    for (i32 i = r.size() - 1; i >= 0; i--) {
        u32 e = lower_bound(r.begin() + i, r.begin() + r.size(), make_pair(r[i].second, 0)) - r.begin();
        R[i] = max(R[i + 1], R[e] + 1);
    }

    //for (i32 i = 0; i < r.size(); i++) {
    //    cout << R[i] << " ";
    //}

    cout << R[0] << endl;

    //for (auto it = r.begin(); it != r.end(); it++) {
    //    cout << it->first << ";" << it->second << endl;
    //}

    return 0;
}


// CodeForceB1.cpp : Defines the entry point for the console application.
//

//#include "stdafx.h"
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;
/*int T[200003];

int get(int idx)
{
	int sum = 0;
	while (idx > 0)
	{
		sum += T[idx];
		idx -= (idx & -idx);
	}
	return sum;
}

void set(int idx, int val)
{
	while (idx <= 200002)
	{
		T[idx] += val;
		idx += (idx & -idx);
	}
}*/

int main(int argc, char* argv[])
{

	//freopen("output.txt", "w", stdout);
	//freopen("input.txt", "r", stdin);

	int n;
  scanf("%d", &n);

  vector<pair<int, int>> X;
  vector<int> R;
  X.reserve(n);
  R.reserve(n);
  for (int i = 0; i < n; ++i)
  {
	  int x, w;
	  scanf("%d%d", &x, &w);
	  X.push_back(make_pair(x + w, x - w));
	  R.push_back(x + w);
  }
  sort(X.begin(), X.end());
  sort(R.begin(), R.end());
  vector<int>::iterator endit = unique(R.begin(), R.end());
  R.resize(distance(R.begin(), endit));
  vector<int> V;
  V.resize(R.size() + 1);
  //memset(T, 0, sizeof(T));

  int pos = 1;
  for (int i = 0; i < n; ++i)
  {
	  int idxL = upper_bound(R.begin(), R.end(), X[i].second) - R.begin();
	  if (X[i].first != R[pos - 1])
		  pos++;
	  V[pos] = max(V[pos - 1], V[idxL] + 1);
  }
  int res = V[V.size() - 1];
  cout << res << endl;
  return 0;
}


// CodeForceB1.cpp : Defines the entry point for the console application.
//

//#include "stdafx.h"
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;
int T[200003];

int get(int idx)
{
	int sum = 0;
	while (idx > 0)
	{
		sum += T[idx];
		idx -= (idx & -idx);
	}
	return sum;
}

void set(int idx, int val)
{
	while (idx <= 200002)
	{
		T[idx] += val;
		idx += (idx & -idx);
	}
}

int main(int argc, char* argv[])
{

	//freopen("output.txt", "w", stdout);
	freopen("input.txt", "r", stdin);

  int n;
  scanf("%d", &n);

  vector<pair<int, int>> X;
  vector<int> R;
  X.reserve(n);
  R.reserve(n);
  for (int i = 0; i < n; ++i)
  {
	  int x, w;
	  scanf("%d %d", &x, &w);
	  X.push_back(make_pair(x - w, x + w));
	  R.push_back(x + w);
  }
  sort(X.begin(), X.end());
  sort(R.begin(), R.end());
  vector<int>::iterator endit = unique(R.begin(), R.end());
  R.resize(distance(R.begin(), endit));
  memset(T, 0, sizeof(T));

  for (int i = 0; i < n; ++i)
  {
	  int idxL = upper_bound(R.begin(), R.end(), X[i].first) - R.begin();
	  int idxR = lower_bound(R.begin(), R.end(), X[i].second) - R.begin();
	  int valL = (idxL > 0) ? get(idxL) : 0;
	  int valR = get(idxR + 1);
	  if (valL + 1 > valR)
		  set(idxR + 1, valL + 1 - valR);
  }
  int res = get(200002);
  cout << res << endl;
  return 0;
}


// CodeForceB1.cpp : Defines the entry point for the console application.
//

//#include "stdafx.h"
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;
int T[200003];

int get(int idx)
{
	int sum = 0;
	while (idx > 0)
	{
		sum += T[idx];
		idx -= (idx & -idx);
	}
	return sum;
}

void set(int idx, int val)
{
	while (idx <= 200002)
	{
		T[idx] += val;
		idx += (idx & -idx);
	}
}

int main(int argc, char* argv[])
{

	//freopen("output.txt", "w", stdout);
	//freopen("input.txt", "r", stdin);

  int n;
  scanf("%d", &n);

  vector<pair<int, int>> X;
  vector<int> R;
  X.reserve(n);
  R.reserve(n);
  for (int i = 0; i < n; ++i)
  {
	  int x, w;
	  scanf("%d %d", &x, &w);
	  X.push_back(make_pair(x - w, x + w));
	  R.push_back(x + w);
  }
  sort(X.begin(), X.end());
  sort(R.begin(), R.end());
  vector<int>::iterator endit = unique(R.begin(), R.end());
  R.resize(distance(R.begin(), endit));
  memset(T, 0, sizeof(T));

  for (int i = 0; i < n; ++i)
  {
	  int idxL = upper_bound(R.begin(), R.end(), X[i].first) - R.begin();
	  int idxR = lower_bound(R.begin(), R.end(), X[i].second) - R.begin();
	  int valL = (idxL > 0) ? get(idxL) : 0;
	  int valR = get(idxR + 1);
	  if (valL + 1 > valR)
		  set(idxR + 1, valL + 1 - valR);
  }
  int res = get(200002);
  cout << res << endl;
  return 0;
}


#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <time.h>

using namespace std;

vector <pair <int, int> > h;

int main() {

	//freopen("input.txt", "r", stdin);
	//freopen("battle.out", "w", stdout);

	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		int x, w;
		scanf("%d%d", &x, &w);
		h.push_back(make_pair(x + w, x - w));
	}

	sort(h.begin(), h.end());

	int r = -1e9 - 1;
	int sum = 0;
	for (int i = 0; i < n; i++) {
		if (h[i].second >= r) {
			sum++;
			r = h[i].first;
		}
	}
	cout << sum;
	//system("pause");
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <time.h>

using namespace std;

vector <pair <int, int> > h;

int main() {

	//freopen("input.txt", "r", stdin);
	//freopen("battle.out", "w", stdout);

	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		int x, w;
		scanf("%d%d", &x, &w);
		h.push_back(make_pair(x - w, 0));
		h.push_back(make_pair(x + w, 1));
	}

	sort(h.begin(), h.end());

	int sum = 0;
	int ans = 0;
	for (int i = 0; i < h.size(); i++) {
		if (h[i].second == 0)
			sum++;
		else
			sum--;
		ans = max(ans, sum);
	}

	cout << ans << '\n';

	//system("pause");
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int>   vi;
typedef vector< ii >  vii;

#define all(x)  (x).begin(), (x).end()
#define fi  first
#define se  second
#define pb  push_back

int const MOD   =  1000000000 + 7 ;
int const MAXN  =  105050         ;
int const MAXSH =  1 << 19        ;
int const SH = 18;

ll gcd(ll x, ll y){ return  y == 0 ? x : gcd( y, x % y ) ; }
ll lcm(ll x, ll y){ return ( x == 0 || y == 0) ? ( x + y ) : ( x / gcd( x, y ) ) * y ; }

/**********************************************************************************************/
typedef unsigned long long ull;

ll powmul(ll x, ll y, ll m)
{
    ll r = 0;

    for(int i= 63; i >= 0; --i)
    {
        int bit = (x >> i ) & 1;
        r = r*2 % m;
        r = (r + bit * y) % m;
    }
    return r;
}

ll powmod(ll x, ll n, ll m )
{
    ll r = 1;
    while ( n > 0 )
    {
        if (n & 1) r = powmul(r, x, m);
        n  >>= 1  ;
        x = powmul(x, x, m);
    }

    return r;
}

bool is_finite(ll p, ll q, ll b)
{
    // p / q
    if ( p == 0 )  return true ;

    ll d = gcd(p, q);
    q /= d ;

    b = powmod(b, 64, q);

    return b == 0 ;

}

int N, M ;

int solve()
{
    scanf("%d", &N);
   // cin >> N ;
    for(int i = 0; i < N; ++i)
    {
        ll p, q, b;
        scanf("%lld%lld%lld", &p, &q, &b);
        //cin >> p >> q >> b;
        if (is_finite(p, q, b)) puts(  "Finite" ) ; else  puts( "Infinite" ) ;
    }
    return 0;

}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ::std::ios::sync_with_stdio(false);
    ::std::cin.tie(0);
    ::std::cout.tie(0);

    solve();

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int>   vi;
typedef vector< ii >  vii;

#define all(x)  (x).begin(), (x).end()
#define fi  first
#define se  second
#define pb  push_back

int const MOD   =  1000000000 + 7 ;
int const MAXN  =  105050         ;
int const MAXSH =  1 << 19        ;
int const SH = 18;

ll gcd(ll x, ll y){ return  y == 0 ? x : gcd( y, x % y ) ; }
ll lcm(ll x, ll y){ return ( x == 0 || y == 0) ? ( x + y ) : ( x / gcd( x, y ) ) * y ; }

/**********************************************************************************************/
typedef unsigned long long ull;

ll powmul(ll x, ll y, ll m)
{
    unsigned long long r = 0, u = y;

    for(int i= 60; i >= 0; i -= 4)
    {
        unsigned long long bit = (x >> i ) & 15;
        r = ( r * 16 % m + bit * y ) % m;
    }

    return r;
}

ll powmod(ll x, ll n, ll m )
{
    ll r = 1;
    while ( n > 0 )
    {
        if (n & 1) r = powmul(r, x, m);
        n  >>= 1  ;
        x = powmul(x, x, m);
    }

    return r;
}

bool is_finite(ll p, ll q, ll b)
{
    // p / q
    if ( p == 0 )  return true ;

    ll d = gcd(p, q);
    q /= d ;

    while( q != 1 )
    {
        while(q % b == 0) q /= b;

        b = gcd(q, b);

    }

    return q == 1 ;

}

int N, M ;

int solve()
{
    scanf("%d", &N);
   // cin >> N ;
    for(int i = 0; i < N; ++i)
    {
        ll p, q, b;
        scanf("%lld%lld%lld", &p, &q, &b);
        //cin >> p >> q >> b;
        if (is_finite(p, q, b)) puts(  "Finite" ) ; else  puts( "Infinite" ) ;
    }
    return 0;

}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ::std::ios::sync_with_stdio(false);
    ::std::cin.tie(0);
    ::std::cout.tie(0);

    solve();

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int>   vi;
typedef vector< ii >  vii;

#define all(x)  (x).begin(), (x).end()
#define fi  first
#define se  second
#define pb  push_back

int const MOD   =  1000000000 + 7 ;
int const MAXN  =  105050         ;
int const MAXSH =  1 << 19        ;
int const SH = 18;

ll gcd(ll x, ll y){ return  y == 0 ? x : gcd( y, x % y ) ; }
ll lcm(ll x, ll y){ return ( x == 0 || y == 0) ? ( x + y ) : ( x / gcd( x, y ) ) * y ; }

/**********************************************************************************************/
typedef unsigned long long ull;

ll powmul(ll x, ll y, ll m)
{
    unsigned long long r = 0, u = y;

    for(int i= 60; i >= 0; i -= 4)
    {
        unsigned long long bit = (x >> i ) & 15;
        r = ( r * 16 % m + bit * y ) % m;
    }

    return r;
}

ll powmod(ll x, ll n, ll m )
{
    ll r = 1;
    while ( n > 0 )
    {
        if (n & 1) r = powmul(r, x, m);
        n  >>= 1  ;
        x = powmul(x, x, m);
    }

    return r;
}

bool is_finite(ll p, ll q, ll b)
{
    // p / q
    if ( p == 0 )  return true ;

    ll d = gcd(p, q);
    q /= d ;

    while( b != 1 )
    {
        while(q % b == 0 ) q /= b;

        b = gcd(q, b);

        q /= b;
    }

    return q == 1 ;

}

int N, M ;

int solve()
{
    scanf("%d", &N);
   // cin >> N ;
    for(int i = 0; i < N; ++i)
    {
        ll p, q, b;
        scanf("%lld%lld%lld", &p, &q, &b);
        //cin >> p >> q >> b;
        if (is_finite(p, q, b)) puts(  "Finite" ) ; else  puts( "Infinite" ) ;
    }
    return 0;

}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ::std::ios::sync_with_stdio(false);
    ::std::cin.tie(0);
    ::std::cout.tie(0);

    solve();

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int>   vi;
typedef vector< ii >  vii;

#define all(x)  (x).begin(), (x).end()
#define fi  first
#define se  second
#define pb  push_back

int const MOD   =  1000000000 + 7 ;
int const MAXN  =  105050         ;
int const MAXSH =  1 << 19        ;
int const SH = 18;

ll gcd(ll x, ll y){ return  y == 0 ? x : gcd( y, x % y ) ; }
ll lcm(ll x, ll y){ return ( x == 0 || y == 0) ? ( x + y ) : ( x / gcd( x, y ) ) * y ; }

/**********************************************************************************************/
typedef unsigned long long ull;

ll powmul(ll x, ll y, ll m)
{
    unsigned long long r = 0, u = y;

    for(int i= 60; i >= 0; i -= 4)
    {
        unsigned long long bit = (x >> i ) & 15;
        r <<= 4;
        r += bit * u ;
        r %= m;
    }

    return r;
}

ll powmod(ll x, ll n, ll m )
{
    ll r = 1;
    while ( n > 0 )
    {
        if (n & 1) r = powmul(r, x, m);
        n  >>= 1  ;
        x = powmul(x, x, m);
    }

    return r;
}

bool is_finite(ll p, ll q, ll b)
{
    // p / q
    if ( p == 0 )  return true ;

    ll d = gcd(p, q);
    q /= d ;

    b = powmod(b, 64, q);

    return b == 0 ;

}

int N, M ;

int solve()
{
    scanf("%d", &N);
   // cin >> N ;
    for(int i = 0; i < N; ++i)
    {
        ll p, q, b;
        scanf("%lld%lld%lld", &p, &q, &b);
        //cin >> p >> q >> b;
        if (is_finite(p, q, b)) puts(  "Finite" ) ; else  puts( "Infinite" ) ;
    }
    return 0;

}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ::std::ios::sync_with_stdio(false);
    ::std::cin.tie(0);
    ::std::cout.tie(0);

    solve();

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define int long long

namespace IO {
char buf_[1 << 21], *p1_ = buf_, *p2_ = buf_;
#define ch()                                                                 \
  (p1_ == p2_ &&                                                             \
           (p2_ = (p1_ = buf_) + fread(buf_, 1, 1 << 21, stdin), p1_ == p2_) \
       ? EOF                                                                 \
       : *p1_++)
inline int in() {
  int s = 0, f = 1;
  char x = ch();
  for (; x < '0' || x > '9'; x = ch())
    if (x == '-') f = -1;
  for (; x >= '0' && x <= '9'; x = ch()) s = (s * 10) + (x & 15);
  return f == 1 ? s : -s;
}
char buf__[1 << 21];
int p1__ = -1, p2__ = (1 << 21) - 1;
inline void flush() {
  fwrite(buf__, 1, p1__ + 1, stdout);
  p1__ = -1;
}
inline void pc(char x) {
  if (p1__ == p2__) flush();
  buf__[++p1__] = x;
}
inline void out(int x) {
  char k[30];
  int pos = 0;
  if (!x) return pc('0');
  if (x < 0) pc('-'), x = -x;
  while (x) k[++pos] = (x % 10) | 48, x /= 10;
  for (int i = pos; i; i--) pc(k[i]);
}
inline void out(string x) {
  int k = x.size();
  for (int i = 0; i < k; i++) pc(x[i]);
}
}  // namespace IO
using namespace IO;

inline int gcd(int x, int y) { return !y ? x : gcd(y, x % y); }

inline int work(int p, int q, int b) {
  q /= gcd(p, q);
  while (q != 1 && b != 1) {
    q /= gcd(b, q);
    b = gcd(b, q);
    b *= b;
  }
  return (q == 1);
}

signed main() {
  int Ts = in();
  while (Ts--) {
    int p = in(), q = in(), b = in();
    if (!p)
      out("No\n");
    else
      out(work(p, q, b) ? "Finite\n" : "Infinite\n");
  }
  flush();
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define int long long

namespace IO {
char buf_[1 << 21], *p1_ = buf_, *p2_ = buf_;
#define ch()                                                                 \
  (p1_ == p2_ &&                                                             \
           (p2_ = (p1_ = buf_) + fread(buf_, 1, 1 << 21, stdin), p1_ == p2_) \
       ? EOF                                                                 \
       : *p1_++)
inline int in() {
  int s = 0, f = 1;
  char x = ch();
  for (; x < '0' || x > '9'; x = ch())
    if (x == '-') f = -1;
  for (; x >= '0' && x <= '9'; x = ch()) s = (s * 10) + (x & 15);
  return f == 1 ? s : -s;
}
char buf__[1 << 21];
int p1__ = -1, p2__ = (1 << 21) - 1;
inline void flush() {
  fwrite(buf__, 1, p1__ + 1, stdout);
  p1__ = -1;
}
inline void pc(char x) {
  if (p1__ == p2__) flush();
  buf__[++p1__] = x;
}
inline void out(int x) {
  char k[30];
  int pos = 0;
  if (!x) return pc('0');
  if (x < 0) pc('-'), x = -x;
  while (x) k[++pos] = (x % 10) | 48, x /= 10;
  for (int i = pos; i; i--) pc(k[i]);
}
inline void out(string x) {
  int k = x.size();
  for (int i = 0; i < k; i++) pc(x[i]);
}
}  // namespace IO
using namespace IO;

inline int gcd(int x, int y) { return !y ? x : gcd(y, x % y); }

inline int work(int p, int q, int b) {
  q /= gcd(p, q);
  while (q != 1 && b != 1) {
    q /= gcd(b, q);
    b = gcd(b, q);
    b *= b;
  }
  return (q == 1);
}

signed main() {
  int Ts = in();
  while (Ts--) {
    int p = in(), q = in(), b = in();
    if (!p)
      out("No\n");
    else
      out(work(p, q, b) ? "No\n" : "Yes\n");
  }
  flush();
  return 0;
}