The clique problem is one of the most well-known NP-complete problems. Under some simplification it can be formulated as follows. Consider an undirected graph G. It is required to find a subset of vertices C of the maximum size such that any two of them are connected by an edge in graph G. Sounds simple, doesn't it? Nobody yet knows an algorithm that finds a solution to this problem in polynomial time of the size of the graph. However, as with many other NP-complete problems, the clique problem is easier if you consider a specific type of a graph.

Consider n distinct points on a line. Let the i-th point have the coordinate x_{i} and weight w_{i}. Let's form graph G, whose vertices are these points and edges connect exactly the pairs of points (i, j), such that the distance between them is not less than the sum of their weights, or more formally: |x_{i} - x_{j}| ≥ w_{i} + w_{j}.

Find the size of the maximum clique in such graph.


-----Input-----

The first line contains the integer n (1 ≤ n ≤ 200 000) — the number of points.

Each of the next n lines contains two numbers x_{i}, w_{i} (0 ≤ x_{i} ≤ 10^9, 1 ≤ w_{i} ≤ 10^9) — the coordinate and the weight of a point. All x_{i} are different.


-----Output-----

Print a single number — the number of vertexes in the maximum clique of the given graph.


-----Examples-----
Input
4
2 3
3 1
6 1
0 2

Output
3



-----Note-----

If you happen to know how to solve this problem without using the specific properties of the graph formulated in the problem statement, then you are able to get a prize of one million dollars!

The picture for the sample test. [Image]

Difficulty: interview

Starter code:

Solutions:
from sys import stdin
from sys import stdout
from collections import defaultdict
n=int(stdin.readline())
a=[map(int,stdin.readline().split(),(10,10)) for i in range(n)]
v=defaultdict(list)
for i,e in enumerate(a,1):
    q,f=e
    v[q-f].append(i)
    v[q+f-1].append(-i)
sa=set()
rez=0
for j in sorted(v.keys()):
    for d in v[j]:
        if d>0:
            sa.add(d)
    for d in v[j]:
        if -d in sa:
            sa.clear()
            rez+=1
stdout.write(str(rez))

n = int(input())
l = []
for i in range(n):
    x, y = map(int,input().split())
    l   += [(x + y, x - y)]
l.sort()
r = -2000000000
a = 0
for u in l:
    if u[1] >= r:
        a += 1
        r  = u[0]
print(a)

#!/usr/bin/env python
# coding=utf-8

n = int(input())
l = []
for i in range(n):
    x, y = list(map(int, input().split()))
    l += [(x + y, x - y)]
l.sort()
r = -2000000000
a = 0
for u in l:
    if u[1] >= r:
        a += 1
        r = u[0]
print(a)


n = int(input())
l = sorted([(x[0] - x[1],x[0] + x[1]) for x in [list(map(int,input().split())) for _ in range(n)]],key=lambda x: x[1])
ans = 1; cur = 0
for i in range(1,n):
    if l[cur][1] <= l[i][0]:
        cur = i; ans += 1
print (ans)

n = int(input())
S=[]
for _ in range(n):
    x,w = list(map(int,input().split()))
    S.append((x,w))
S = sorted(S,key=lambda kv:kv[0]+kv[1])
m=1
last=S[0]
for kv in S[1:]:
    if abs(kv[0]-last[0]) >= kv[1]+last[1]:
        m+=1
        last=kv
print(m)



def read_data():
    n = int(input())
    ranges = []
    buffer = [input() for i in range(n)]
    for xw in buffer:
        x, w = map(int, xw.split())
        ranges.append((x + w, x - w))
    return n, ranges

def solve(n, ranges):
    ranges.sort()
    n = 0
    end = - float('inf')
    for e, b in ranges:
        if b >= end:
            n += 1
            end = e
    return n

n, ranges = read_data()
print(solve(n, ranges))

import sys

n = int(input())
ranges = []
for xw in sys.stdin:
    x, w = map(int, xw.split())
    ranges.append((x + w, x - w))
ranges.sort()
result = 0
end = - float('inf')
for e, b in ranges:
    if b >= end:
        result += 1
        end = e
print(result)

from pip._vendor.distlib.compat import raw_input

n = int(input())
a = []

for i in range(n):
    ta, tb = list(map(int,input().split()))
    a.append((ta,tb))

a.sort()
ans = 1
ta, tb = a[0][0],a[0][1]
for i in range(1,n):
    if a[i][0]-a[i][1] >=ta+tb:
        ans += 1
        ta = a[i][0]
        tb = a[i][1]
    elif a[i][0]+a[i][1] < ta+tb:
        ta = a[i][0]
        tb = a[i][1]
print(ans)
        


N = int(input())

pairs = []
for i in range(N):
    x, w = list(map(int, input().split()))
    pairs.append((x, w))

sorted_pairs = sorted(pairs, key=lambda x: x[0])

stack = []
stack.append(sorted_pairs[0])
for x, w in sorted_pairs[1:N]:
    right_x, right_w = stack[-1]
    if right_x + right_w <= x - w:
        stack.append((x, w))
    else:
        if x + w < right_x + right_w:
            stack[-1] = (x, w)

print(len(stack))


def on(l1, l2):
    return(abs(l1[0]-l2[0])>=l1[1]+l2[1])
n = int(input())
inf = []
for i in range(n):
    a,b = list(map(int,input().split()))
    inf.append([a+b,a-b])
inf.sort()
res = 1
last = 0
for i in range(1,n):
    if inf[i][1] >= inf[last][0]:
        res+=1
        last = i
print(res)



R = lambda: list(map(int,input().split()))
n = int(input())
a = []
for _ in range(n):
    a.append(R())
a.sort(key=lambda x:(x[0]+x[1]))
j = 0; ans = 1
for i in range(1,n):
    if a[j][0]+a[j][1]<=a[i][0]-a[i][1]:
        ans += 1
        j = i
print(ans)

from sys import stdin,setrecursionlimit
import threading

def main():
    n = int(stdin.readline())

    line = []

    for i in range(n):
        x, w = [int(x) for x in stdin.readline().split()]
        line.append((x-w,x+w))

    line.sort()

    def best(ind, line):
        r = line[ind][1]
        nxt = ind+1
        while nxt < len(line):
            nL, nR = line[nxt]
            if nL >= r:
                return best(nxt, line)+1
            elif nR < r:
                return best(nxt,line)
            nxt += 1
        return 1
    print(best(0,line))

def __starting_point():
    setrecursionlimit(10**6)
    threading.stack_size(10**8)
    t = threading.Thread(target=main)
    t.start()
    t.join()
        

__starting_point()