Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.

There are n trees located along the road at points with coordinates x_1, x_2, ..., x_{n}. Each tree has its height h_{i}. Woodcutters can cut down a tree and fell it to the left or to the right. After that it occupies one of the segments [x_{i} - h_{i}, x_{i}] or [x_{i};x_{i} + h_{i}]. The tree that is not cut down occupies a single point with coordinate x_{i}. Woodcutters can fell a tree if the segment to be occupied by the fallen tree doesn't contain any occupied point. The woodcutters want to process as many trees as possible, so Susie wonders, what is the maximum number of trees to fell. 


-----Input-----

The first line contains integer n (1 ≤ n ≤ 10^5) — the number of trees.

Next n lines contain pairs of integers x_{i}, h_{i} (1 ≤ x_{i}, h_{i} ≤ 10^9) — the coordinate and the height of the і-th tree.

The pairs are given in the order of ascending x_{i}. No two trees are located at the point with the same coordinate.


-----Output-----

Print a single number — the maximum number of trees that you can cut down by the given rules.


-----Examples-----
Input
5
1 2
2 1
5 10
10 9
19 1

Output
3

Input
5
1 2
2 1
5 10
10 9
20 1

Output
4



-----Note-----

In the first sample you can fell the trees like that:   fell the 1-st tree to the left — now it occupies segment [ - 1;1]  fell the 2-nd tree to the right — now it occupies segment [2;3]  leave the 3-rd tree — it occupies point 5  leave the 4-th tree — it occupies point 10  fell the 5-th tree to the right — now it occupies segment [19;20] 

In the second sample you can also fell 4-th tree to the right, after that it will occupy segment [10;19].

Difficulty: interview

Starter code:

Solutions:
n = int(input())
p = -float("INF")
ans = 1
A = []
for i in range(n) :
    x, h = list(map(int, input().split()))
    A.append([x,h])
for i in range(n-1) :
    x, h = A[i]
    if x-h > p :
        ans += 1
        p = x
    elif x+h < A[i+1][0] :
        ans += 1
        p = x+h
    else :
        p = x
print(ans)


n = int(input())
k = []
for i in range(n):
    k.append(list(map(int, input().split())))

if n == 1:
    print(1)
else:
    ans = 2
    for i in range(1, n-1):
        if k[i][0]-k[i][1] > k[i-1][0]:
            ans += 1
        elif k[i][0]+k[i][1] < k[i+1][0]:
            k[i][0] += k[i][1]
            ans += 1
    print(ans)

n = int(input())
x = [0] * (n + 1)
h = [0] * (n + 1)

for i in range(n):
    x[i], h[i] = (int(c) for c in input().split())

h[n] = 1
x[n] = x[n-1] + h[n-1] + 1

if n == 1:
    print(1)
    return

left = [0] * n
right = [0] * n

left[0] = 1
if x[0] + h[0] < x[1]:
    right[0] = 1

for i in range(1, n):
    if x[i] + h[i] < x[i + 1]:
        right[i] = max(right[i-1], left[i-1]) + 1
    else:
        right[i] = max(right[i-1], left[i-1])

    if x[i] - h[i] > x[i-1] + h[i-1]:
        left[i] = max(right[i-1], left[i-1]) + 1
    elif x[i] - h[i] > x[i-1]:
        left[i] = left[i-1] + 1
    else:
        left[i] = max(right[i-1], left[i-1])

print(max(left[n-1], right[n-1]))

a = int(input())
trees = []
for i in range(a):
    trees.append([int(x) for x in input().split()])
trees.append([1000000000000, 1])
left = -10000000000
c = 0
for i in range(a):
    if trees[i][0] - trees[i][1] > left:
        left = trees[i][0]
        c += 1
    elif trees[i][0] + trees[i][1] < trees[i + 1][0]:
        left = trees[i][0] + trees[i][1]
        c += 1
    else:
        left = trees[i][0]
print(c)



n = int(input())

arr = [0] * (n + 2)
arr[0] = [-2000000001, -2000000001, 0]
arr[-1] = [2000000001, 2000000001, 0]
for i in range(1, n + 1):
   s = list(map(int, input().split()))
   arr[i] = [s[0], s[0], s[1]]
c = 0
for i in range(1, n + 1):
   if (arr[i - 1][0] < (arr[i][0] - arr[i][2])) and (arr[i - 1][1] < (arr[i][0] - arr[i][2])):
      arr[i][1] = arr[i][0] - arr[i][2]
      c += 1
   elif (arr[i + 1][0] > (arr[i][0] + arr[i][2])) and (arr[i + 1][1] > (arr[i][0] + arr[i][2])):
      arr[i][1] = arr[i][0] + arr[i][2]
      c += 1
      #print(i)
print(c)

n = int(input())
data = []
for i in range(n):
    x, h = [int(y) for y in input().split()]
    data.append([x, h])
lastOccupied = -99999999999
answer = 0
if n == 1:
    print(1)
    return
if n == 2:
    print(2)
    return
for i in range(n - 1):
    if data[i][0] - data[i][1] > lastOccupied:
        answer += 1
        lastOccupied = data[i][0]
    elif data[i][0] + data[i][1] < data[i + 1][0]:
        lastOccupied = data[i][0] + data[i][1]
        answer += 1
    else:
        lastOccupied = data[i][0]

answer += 1
print(answer)


n = int(input())
ar = []
for i in range(n):
    ar.append(list(map(int, input().split())))
ar = list(sorted(ar))
if n == 1:
    print(1)
else:    
    sum1 = 0
    ind = [0] * n
    r = ar[0][0]
    for i in range(1, n - 1):
        if ar[i][0] - ar[i][1] > max(r, ar[i - 1][0]):
            sum1 += 1
        elif ar[i][0] + ar[i][1] < ar[i + 1][0]:
            sum1 += 1
            r = max(r, ar[i][0] + ar[i][1] )
        
    print(sum1 + 2)

from fileinput import *

data = []
for line in input():
    if lineno() == 1:
        [n] = list(map(int, line.split()))
    else:
        data.append(list(map(int, line.split())))

if n <= 2:
    o = n

else:
    o = 2

    for i in range(1, n - 1):
        rminus = data[i][0] - data[i][1]
        rplus = data[i][0] + data[i][1]

        if rminus > data[i-1][0]:
            o += 1
        elif rplus < data[i+1][0]:
            o += 1
            data[i][0] = rplus

print(o)


n = int(input())

a = []
b = []

for i in range(n):
	x,y = map(int,input().split())
	a.append(x)
	b.append(y)

if(n >= 2):
	total = 2
elif(n == 1):
	total = 1

p = a[0]

for i in range(1,n-1):
	c = a[i] - b[i]
	d = a[i]+b[i]
	if(c > 0 and c > p):
		p = a[i]
		total += 1
	elif(d < a[i+1]):
		p = d
		total += 1
	else:
		p = a[i]

print(total)

n = int(input())
s=[]
for i in range(n):
    s.append([tuple(map(int, input().split())), 's'])
if n >= 2:
    s[0][1]='l'
    s[-1][1]='r'
    ans=2
    for i in range(1, len(s)-1):
        l = s[i][0][0]-s[i-1][0][0]
        r = s[i+1][0][0]-s[i][0][0]
        if s[i-1][1]=='r':
            l-=s[i-1][0][1]
        #print(l, r, s[i][0][1])
        if s[i][0][1] < l:
            s[i][1]='l'
            ans+=1
            #print(i, end=' ')
        elif s[i][0][1]<r:
            s[i][1]='r'
            ans+=1
            #print(i+1, end=' ')
        #print()
    #print(s)
    print(ans)
else:
    print(1)
#print(s)


a=int(input())
if a==1:
    b1, c1=map(int, input().split())
    print(1)
else:
    b1, c1=map(int, input().split())
    ch=2
    b2, c2=map(int, input().split())
    for i in range(a-2):
        b3, c3=map(int, input().split())
        if c2<(b2-b1):
            ch=ch+1
        elif c2<(b3-b2):
            ch=ch+1
            b2=b2+c2
        b1=b2
        c1=c2
        b2=b3
        c2=c3
    print(ch)

n=int(input())
inp=[[int(x) for x in input().split()] for i in range(n)]
ans=0
least=0
for i in range(0,n):
	if i==0 or least<inp[i][0]-inp[i][1]:
		ans+=1
		least=inp[i][0]
	elif i==n-1 or i+1<n and inp[i][0]+inp[i][1]<inp[i+1][0]:
		least=inp[i][0]+inp[i][1]
		ans+=1
	else:
		least=inp[i][0]
print(ans)


n = int(input())

data = []
for i in range(n):
    a, b =  list(map(int, input().split()))
    data.append([a,b,0])
    
if (n==1):
    count = 1
else:
    count = 2

for i in range(1,n-1):
    if (data[i][0]-data[i-1][0]>data[i][1]):
        count += 1
    elif (data[i+1][0]-data[i][0]>data[i][1]):
        count += 1
        data[i][0] += data[i][1]

print(count)


N = int(input())
trees = [list(map(int, input().split())) for _ in range(N)]

ans = 2 if N >= 2 else 1
for i in range(1, N-1):
    x, h = trees[i]
    px, ph = trees[i-1]
    nx, nh = trees[i+1]
    if px < x - h:
        ans += 1
    elif x + h < nx:
        trees[i][0] = x + h
        ans += 1
print(ans)
        
    


#!/usr/bin/env python3
# -*- coding: utf-8 -*-



n  = int(input())
X = []
H = []

for i in range(n):
    (x, h) = (int(i) for i in input().split())
    X += [x]
    H += [h]

if n < 3:
    tr = n
else:
    tr = 2
    min = X[0]
    for i in range(1, n-1):
        if min < X[i] - H[i] :
            tr += 1
            min = X[i]
        elif X[i+1]> X[i] + H[i]:
            tr +=1
            min = X[i]+H[i]
        else:
            min = X[i]

print(tr)





n = int(input())
h = [0]*n
x = [0]*n
for i in range(n):
    x[i], h[i] = list(map(int, input().split()))
ans = 2 if n >= 2 else 1
for i in range(1, n-1):
    if x[i] - x[i-1] > h[i]:
        ans += 1
    elif x[i+1] - x[i] > h[i]:
        ans += 1
        x[i] += h[i]
print(ans)


n = int(input())

coordinates = []
heights = []
for i in range(n):
	x, h = map(int, input().split())
	coordinates.append(x)
	heights.append(h)

if n == 1:
	answer = 1
else:
	answer = 2
for i in range(1, n-1):
	if coordinates[i]-heights[i] > coordinates[i-1]:
		answer += 1
	elif coordinates[i]+heights[i] < coordinates[i+1]:
		answer += 1
		coordinates[i] += heights[i]
print(answer)

def solve():
    n=int(input());
    h=[0]*n;
    x=[0]*n;
    for i in range(n):
        x[i],h[i]=map(int,input().split());
    ans=2;
    for i in range(1,n-1):
        if(x[i]-x[i-1]>h[i]): ans+=1;
        elif (x[i+1]-x[i]>h[i]):
            ans+=1;
            x[i]+=h[i];
    if(n<=2): ans=n;
    print(ans);
solve();

n = int(input())
posi = []
high = []
for _ in range(n):
    [a,b] = input().strip().split()
    posi.append(int(a))
    high.append(int(b))

if 2<n:
    ans = 0
    last = posi[0]
    for i in range(1,n-1):
        h = high[i]
        if posi[i]-h>last:
            ans+=1
            last = posi[i]
        elif posi[i]+h < posi[i+1]:
            ans+=1
            last = posi[i]+h
        else:
            last = posi[i]
    ans+=2
else:
    ans = n
print(ans)
        

                
                
                
    


n = int(input())

trees = []
for i in range(n):
    xi, hi = list(map(int, input().split()))
    trees.append((xi, hi))

if n == 1:
    print(1)
elif n == 2:
    print(2)
else:
    count = 2
    last = trees[0][0]

    for i in range(1, n - 1):
        x, h = trees[i]
        next = trees[i + 1][0]
        if (x - h) > last:
            #print("last", trees[i], last, next)
            count += 1
            last = x
        elif (x + h) < next:
            #print("next", trees[i], last, next)
            count += 1
            last = x + h
        else:
            last = x

    print(count)


n = int(input())
l = []
for i in range(n):
    l.append(list(map(int, input().split(" "))))

c = 0
left = 0
for i in range(n):
    if i == 0:
        c+= 1
        left = l[0][0]
        continue
    else:
        if l[i][0] - l[i][1] > left:
            c+=1
            left = l[i][0]
            continue
        elif not i == n-1:    
            if l[i][0] + l[i][1] < l[i+1][0]:
                c+=1
                left = l[i][0] + l[i][1]
                continue
            else: left = l[i][0]
        elif i == n-1:
            c+=1
            break
        else:
            left = l[i][0]
            continue
print(c)

n = int(input())
x = [0] * n
h = [0] * n
for i in range(n):
    x[i], h[i] = map(int, input().split())
ans = min(n, 2)
k = x[0]
for i in range(1, n - 1):
    if x[i] - h[i] > k:
        ans += 1
        k = x[i]
    elif x[i] + h[i] < x[i + 1]:
        ans += 1
        k = x[i] + h[i]
    else:
        k = x[i]
print(ans)

n = int(input())
trees = [ tuple(map(int, input().split())) for i in range(n) ]

prevx = -1e15;
ans = 0
for i in range(n):
    if i == n-1: 
        ans+=1
        break
    x,h = trees[i]
    if x - h > prevx:
        prevx = x
        ans += 1
    elif x + h < trees[i+1][0]: 
        ans += 1
        prevx = x + h
    else: prevx = x
print(ans)

n = int(input())
if(n == 1):
	print(1)
	return
a = [0 for x in range(n)]
h = [0 for x in range(n)]
for x in range(n):
	a[x], h[x] = map(int,input().split())

dp = [[0 for x in range(3)] for x in range(n)]
## 0 left 1 stay 2 right
L = 0
S = 1
R = 2
dp[0][L] = 1
dp[0][S] = 0
dp[0][R] = 1 if a[0] + h[0] < a[1] else 0
for x in range(1,n):
	## Stay
	dp[x][S] = max(dp[x-1][L],dp[x-1][S],dp[x-1][R])
	
	## Left
	if(a[x] - h[x] > a[x-1]):
		dp[x][L] = max(dp[x-1][L],dp[x-1][S]) ## S L
		if(a[x-1] + h[x-1] < a[x] - h[x]):
			dp[x][L] = max(dp[x][L], dp[x-1][R]) ## R L
		dp[x][L] += 1
	else:
		dp[x][L] = max(dp[x-1][L],dp[x-1][S],dp[x-1][R])
	
	## Right
	if(x + 1 >= n or a[x] + h[x] < a[x+1]):
		dp[x][R] = max(dp[x-1][L],dp[x-1][S],dp[x-1][R]) + 1
	else:
		dp[x][R] = max(dp[x-1][L],dp[x-1][S],dp[x-1][R])
	
	## print(dp[x][L],dp[x][S],dp[x][R])

print(max(dp[n-1][L],dp[n-1][S],dp[n-1][R]))

n = int(input())
if(n == 1):
	print(1)
	return
a = [0 for x in range(n)]
h = [0 for x in range(n)]
for x in range(n):
	a[x], h[x] = list(map(int,input().split()))

dp = [[0 for x in range(3)] for x in range(n)]
## 0 left 1 stay 2 right
L = 0
S = 1
R = 2
dp[0][L] = 1
dp[0][S] = 0
dp[0][R] = 1 if a[0] + h[0] < a[1] else 0
for x in range(1,n):
	## Stay
	dp[x][S] = max(dp[x-1][L],dp[x-1][S],dp[x-1][R])
	
	## Left
	if(a[x] - h[x] > a[x-1]):
		dp[x][L] = max(dp[x-1][L],dp[x-1][S]) ## S L
		if(a[x-1] + h[x-1] < a[x] - h[x]):
			dp[x][L] = max(dp[x][L], dp[x-1][R]) ## R L
		dp[x][L] += 1
	else:
		dp[x][L] = max(dp[x-1][L],dp[x-1][S],dp[x-1][R])
	
	## Right
	if(x + 1 >= n or a[x] + h[x] < a[x+1]):
		dp[x][R] = max(dp[x-1][L],dp[x-1][S],dp[x-1][R]) + 1
	else:
		dp[x][R] = max(dp[x-1][L],dp[x-1][S],dp[x-1][R])

print(max(dp[n-1][L],dp[n-1][S],dp[n-1][R]))