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].

Source: codeforces | Difficulty: MEDIUM
Tags: Dynamic programming

Greedy algorithms


Solutions:
N = int(input())
X = []
H = []
for i in range(N):
	(x, h) = map(int, input().split())
	X.append(x)
	H.append(h)
if N == 1:
	print(1)
	exit()
ans = 2
for i in range(1, N - 1):
	if X[i] - H[i] > X[i - 1]:
		ans += 1
	elif X[i] + H[i] < X[i + 1]:
		ans += 1
		X[i] += H[i]
print(ans)


def solution(x, h):
	if len(x) == 1:
		return 1
	last_x = x[0]
	ans = 2
	for i in range(1, N - 1):
		if x[i] - h[i] > last_x:
			last_x = x[i]
			ans += 1
		elif x[i] + h[i] < x[i + 1]:
			last_x = x[i] + h[i]
			ans += 1
		else:
			last_x = x[i]
	return ans
N = int(input())
x = []
h = []
for i in range(N):
	(a, b) = map(int, input().split())
	x.append(a)
	h.append(b)
print(solution(x, h))


n = int(input())
lx = []
lh = []
for i in range(n):
	(x, h) = [int(x) for x in input().split()]
	lx.append(x)
	lh.append(h)
if n == 1:
	print('1')
else:
	num = 2
	for i in range(1, n - 1):
		if lh[i] < lx[i] - lx[i - 1]:
			num += 1
		elif lh[i] < lx[i + 1] - lx[i]:
			num += 1
			lx[i] += lh[i]
	print(num)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
n = Int()
tree = []
for i in range(n):
	tree.append(value())
last = tree[0][0]
ans = 2
if len(tree) == 1:
	ans -= 1
for i in range(1, n - 1):
	l = tree[i][0]
	h = tree[i][1]
	if l - last - 1 >= h:
		last = l
		ans += 1
	elif tree[i + 1][0] - l - 1 >= h:
		last = l + h
		ans += 1
	else:
		last = l
print(ans)


def solution(x, h):
	if len(x) == 1:
		return 1
	ans = 0
	maxR = x[0] - h[0] - 1
	for inx in range(len(x) - 1):
		if x[inx] - h[inx] > maxR:
			ans += 1
			maxR = x[inx]
		elif x[inx] + h[inx] < x[inx + 1]:
			ans += 1
			maxR = x[inx] + h[inx]
		else:
			maxR = x[inx]
	return ans + 1
x = []
h = []
n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	x.append(a)
	h.append(b)
print(solution(x, h))


n = int(input())
a = [[int(x) for x in input().split()] for i in range(n)]
if n == 1:
	sum1 = 1
else:
	sum1 = 2
	test = a[0][0]
	for j in range(1, len(a) - 1):
		if a[j][0] - a[j][1] > test:
			sum1 += 1
			test = a[j][0]
		elif a[j][0] + a[j][1] < a[j + 1][0]:
			sum1 += 1
			test = a[j][0] + a[j][1]
		else:
			test = a[j][0]
print(sum1)


n = int(input())
A = []
B = []
for i in range(n):
	(a, b) = map(int, input().split())
	A.append(a)
	B.append(b)
if n == 1:
	print('1')
elif n == 2:
	print('2')
else:
	s = 2
	for i in range(1, n - 1):
		if A[i] - A[i - 1] > B[i]:
			s = s + 1
		elif A[i + 1] - A[i] > B[i]:
			s = s + 1
			A[i] = A[i] + B[i]
		else:
			pass
	print(s)


import sys

def solve():
	n = int(input())
	points = []
	for _ in range(n):
		(x, h) = map(int, input().split())
		points.append((x, h))
	lastPt = -sys.maxsize
	ans = 1
	for i in range(n - 1):
		pt = points[i]
		if pt[0] - pt[1] > lastPt:
			lastPt = pt[0]
			ans += 1
			continue
		npt = points[i + 1]
		if pt[0] + pt[1] < npt[0]:
			lastPt = pt[0] + pt[1]
			ans += 1
		else:
			lastPt = pt[0]
	return ans
print(solve())


n = int(input())
l = [[*map(int, input().split())] for _ in ' ' * n]
a = 0
t = l[0][0]
for i in range(1, n - 1):
	if l[i][0] - t - l[i][1] > 0:
		a += 1
		t = l[i][0]
		continue
	if l[i + 1][0] - l[i][0] - l[i][1] > 0:
		a += 1
		t = l[i][0] + l[i][1]
	else:
		t = l[i][0]
print([1, a + 2][n > 1])


n = int(input())
xh_pair = []
for i in range(n):
	(x, h) = map(int, input().split())
	xh_pair.append((x, h))
nCount = 1
pre = xh_pair[0][0]
for index in range(1, n - 1):
	i = xh_pair[index]
	j = xh_pair[index + 1]
	if i[0] - pre > i[1]:
		nCount += 1
		pre = i[0]
		continue
	if i[0] + i[1] < j[0]:
		nCount += 1
		pre = i[0] + i[1]
		continue
	pre = i[0]
if n == 1:
	print(1)
else:
	print(nCount + 1)


def solve(x, h):
	n = len(x)
	res = 1
	left = x[0]
	for i in range(1, n):
		if left < x[i] - h[i]:
			left = x[i]
			res += 1
		elif i == n - 1 or x[i] + h[i] < x[i + 1]:
			left = x[i] + h[i]
			res += 1
		else:
			left = x[i]
	return res
n = int(input())
(x, h) = ([], [])
for i in range(n):
	(xi, hi) = map(int, input().split())
	x.append(xi)
	h.append(hi)
print(solve(x, h))


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


n = int(input())
a = [[int(i) for i in input().split()] for j in range(n)]
x = [[0 for k in range(2)] for i in range(n)]
x[0][0] = a[0][0] - a[0][1]
x[0][1] = a[0][0]
c = n
for i in range(1, n - 1):
	if a[i][0] - a[i][1] > x[i - 1][1]:
		x[i][0] = a[i][0] - a[i][1]
		x[i][1] = a[i][0]
	elif a[i][0] + a[i][1] < a[i + 1][0]:
		x[i][0] = a[i][0]
		x[i][1] = a[i][0] + a[i][1]
	else:
		x[i][0] = x[i][1] = a[i][0]
		c -= 1
print(c)


n = int(input())
d = dict()
for i in range(n):
	(x, y) = map(int, input().split())
	d[x] = y
k = sorted(d.keys())
if len(k) < 2:
	print(len(k))
else:
	down = 2
	occ = k[0]
	for num in range(1, n - 1):
		if k[num] - occ > d[k[num]]:
			down += 1
			occ = k[num]
		elif k[num + 1] - k[num] > d[k[num]]:
			down += 1
			occ = k[num] + d[k[num]]
		else:
			occ = k[num]
	print(down)


import sys
try:
	fin = open('test.in', 'r').readline
except:
	fin = sys.stdin.readline
n = int(fin())
a = [tuple(map(int, fin().split())) for i in range(n)]
a.append((3000000000.0, 0))
pos = -1000000000.0
ans = 0
for i in range(n):
	if a[i][0] - a[i][1] > pos:
		pos = a[i][0]
		ans += 1
	elif a[i][0] + a[i][1] < a[i + 1][0]:
		pos = a[i][0] + a[i][1]
		ans += 1
	else:
		pos = a[i][0]
print(ans)


n = int(input())
a = [[int(x) for x in input().split()] for i in range(n)]
num = 2
for i in range(1, n - 1):
	if a[i][0] - a[i][1] > a[i - 1][0]:
		num += 1
	elif a[i][0] + a[i][1] < a[i + 1][0]:
		num += 1
		a[i][0] = a[i][0] + a[i][1]
print([1, num][n > 1])


import sys
input = sys.stdin.readline
n = int(input())
s = []
for _ in range(n):
	(a, b) = map(int, input().split())
	s.append((a, b))
s.sort()
ans = min(2, n)
limit = s[0][0]
for i in range(1, n - 1):
	if s[i][0] - s[i][1] <= limit:
		if s[i][0] + s[i][1] >= s[i + 1][0]:
			limit = s[i][0]
			continue
		ans += 1
		limit = s[i][0] + s[i][1]
		continue
	ans += 1
	limit = s[i][0]
print(ans)


import math, string, itertools, fractions, heapq, collections, re, array, bisect
from itertools import chain, dropwhile, permutations, combinations
from collections import defaultdict

def main(n, x, h):
	s = 0
	last = -10000000000.0
	for i in range(n):
		if i == 0:
			s += 1
			last = x[i]
		elif i == n - 1:
			s += 1
		elif last < x[i] - h[i]:
			s += 1
			last = x[i]
		elif x[i] + h[i] < x[i + 1]:
			s += 1
			last = x[i] + h[i]
		else:
			last = x[i]
	print(s)

def main_input(info=0):
	n = int(input())
	x = list(range(n))
	h = list(range(n))
	for i in range(n):
		(x[i], h[i]) = list(map(int, input().split()))
	main(n, x, h)
main_input()


n = int(input())
a = [[int(x) for x in input().split()] for i in range(n)]
c = [abs(a[i][0] - a[i - 1][0]) for i in range(1, n)]
if n == 1:
	print(1)
else:
	s = 2
	for i in range(1, n - 1):
		if a[i][1] < c[i - 1]:
			s += 1
		elif a[i][1] < c[i]:
			s += 1
			c[i] -= a[i][1]
		else:
			continue
	print(s)


n = int(input())
PreN = -10 ** 9
PreF = True
Cnt = 0
for i in range(n):
	(CurN, CurH) = map(int, input().split())
	if PreF == False and CurN - PreN > PreH:
		Cnt += 1
		PreN += PreH
	if CurN - PreN > CurH:
		Cnt += 1
		PreF = True
	else:
		PreF = False
	(PreN, PreH) = (CurN, CurH)
Cnt += 1 - PreF
print(Cnt)


n = int(input())
t = []
m = 2
for i in range(n):
	t.append([int(x) for x in input().split()])
for i in range(1, n - 1):
	if t[i][0] - t[i][1] > t[i - 1][0]:
		m += 1
	elif t[i][0] + t[i][1] < t[i + 1][0]:
		m += 1
		t[i][0] = t[i][0] + t[i][1]
print([1, m][n > 1])


def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def solve():
	N = getInt()
	trees = []
	for n in range(N):
		trees.append(tuple(getInts()))
	dp = []
	for n in range(N):
		if n == 0:
			dp.append((1, trees[0][0]))
		else:
			(cur_max, right) = dp[-1]
			(x, h) = trees[n]
			if x - h > right and x - h > trees[n - 1][0]:
				dp.append((cur_max + 1, x))
			elif x > right and (n == N - 1 or trees[n + 1][0] > x + h):
				dp.append((cur_max + 1, x + h))
			else:
				dp.append((cur_max, right))
	return dp[-1][0]
ans = solve()
print(ans)


t = int(input())
ht = []
pos = []
res = 1 if t < 2 else 2
for _ in range(t):
	(p, h) = map(int, input().split())
	ht.append(h)
	pos.append(p)
for i in range(1, t - 1):
	if pos[i] - pos[i - 1] > ht[i]:
		res += 1
	elif pos[i + 1] - pos[i] > ht[i]:
		res += 1
		pos[i] += ht[i]
print(res)


n = int(input())
xh = [list(map(int, input().split())) for i in range(n)] + [[10 ** 18, 1]]
xh.sort()
dp = [[0] * 3 for i in range(n)]
dp[0][0] = 1
dp[0][1] = 0
if n == 1:
	dp[0][2] = 1
elif xh[0][0] + xh[0][1] < xh[1][0]:
	dp[0][2] = 1
else:
	dp[0][2] = 0
for i in range(1, n):
	(x, h) = xh[i]
	if xh[i - 1][0] < x - h:
		dp[i][0] = max([dp[i][0], dp[i - 1][0] + 1, dp[i - 1][1] + 1])
	if xh[i - 1][0] + xh[i - 1][1] < x - h:
		dp[i][0] = max(dp[i][0], dp[i - 1][2] + 1)
	dp[i][1] = max(dp[i - 1])
	if x + h < xh[i + 1][0]:
		dp[i][2] = max(dp[i - 1]) + 1
	else:
		dp[i][2] = max(dp[i - 1])
print(max(dp[-1]))


n = int(input())
a = []
b = []
for i in range(n):
	(x, y) = map(int, input().split())
	a.append(x)
	b.append(y)
ans = [0] * n
ans[0] = -1
ans[-1] = 1
for i in range(1, n - 1):
	if ans[i - 1] != 1 and a[i] - b[i] > a[i - 1]:
		ans[i] = -1
	elif ans[i - 1] == 1 and a[i] - b[i] > a[i - 1] + b[i - 1]:
		ans[i] = -1
	elif a[i] + b[i] < a[i + 1]:
		ans[i] = 1
print(sum([1 for i in ans if i != 0]))


n = int(input())
res = 0
left = -10 ** 10
a = input().split()
a = list(map(int, a))
x_cur = a[0]
h_cur = a[1]
for i in range(n - 1):
	a = input().split()
	a = list(map(int, a))
	x_next = a[0]
	h_next = a[1]
	if x_cur - h_cur > left:
		res += 1
		left = x_cur
	elif x_cur + h_cur < x_next:
		res += 1
		left = x_cur + h_cur
	else:
		left = x_cur
	x_cur = x_next
	h_cur = h_next
print(res + 1)


n = int(input())
tree = []
for i in range(n):
	(x, y) = map(int, input().split())
	tree.append((x, y))
if n == 1:
	print(1)
elif n == 2:
	print(2)
else:
	tree.sort()

	def bin(tree, mid, n) -> bool:
		count = 0
		end = tree[0][0]
		fallen = []
		for i in range(1, n - 1):
			if mid - count > n - i:
				return False
			if tree[i][0] - tree[i][1] > end:
				count += 1
				end = tree[i][0]
			elif tree[i][0] + tree[i][1] < tree[i + 1][0]:
				count += 1
				end = tree[i][0] + tree[i][1]
			else:
				end = tree[i][0]
		if count >= mid:
			return True
		return False
	ans = 0
	(start, end) = (0, n - 2)
	while start <= end:
		mid = start + (end - start) // 2
		if bin(tree, mid, n):
			ans = mid
			start = mid + 1
		else:
			end = mid - 1
	print(ans + 2)


import sys
from functools import lru_cache
from collections import defaultdict

@lru_cache(maxsize=None)
def find_min(i, space):
	if i == len(mat):
		return 0
	elif i == len(mat) - 1:
		return 1
	(pos, h) = mat[i]
	if pos - h > space:
		return 1 + find_min(i + 1, pos)
	else:
		if pos + h < mat[i + 1][0]:
			n = 1 + find_min(i + 1, pos + h)
		else:
			n = find_min(i + 1, pos)
		return n

def iterate(arr):
	left = -float('inf')
	s = 1
	for i in range(len(arr) - 1):
		(pos, h) = arr[i]
		n_pos = arr[i + 1][0]
		if pos - h > left:
			s += 1
			left = pos
		elif pos + h < n_pos:
			left = pos + h
			s += 1
		else:
			left = pos
	return s
mat = []
for (e, line) in enumerate(sys.stdin.readlines()):
	if e == 0:
		continue
	mat.append(list(map(int, line.strip().split())))
print(iterate(mat))


n = int(input())
cnt = 0
flag = 0
for i in range(n):
	(x, h) = map(int, input().split())
	if i == 0:
		cnt += 1
		x_prev = x
		flag = 1
	elif flag == 1:
		if x - x_prev > h and i != n - 1:
			cnt += 1
			x_prev = x
		else:
			flag = 0
			x_prev = x
			h_prev = h
	elif flag == 0:
		if x - x_prev > h + h_prev and i != n - 1:
			cnt += 2
			flag = 1
			x_prev = x
		elif x - x_prev > h_prev:
			cnt += 1
			x_prev = x
			h_prev = h
		elif x - x_prev > h and i != n - 1:
			cnt += 1
			x_prev = x
			flag = 1
		else:
			x_prev = x
			h_prev = h
	if i == n - 1 and n != 1:
		if flag == 0:
			if x - x_prev > h_prev:
				cnt += 2
			else:
				cnt += 1
		elif flag == 1:
			cnt += 1
print(cnt)


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


from sys import stdin
N = int(stdin.readline())
X = []
H = []
for n in range(N):
	line = stdin.readline().strip().split()
	X.append(int(line[0]))
	H.append(int(line[1]))
H[0] = 0
H[-1] = 0
for i in range(1, len(X) - 1):
	if H[i] < X[i] - X[i - 1]:
		H[i] = 0
	elif H[i] < X[i + 1] - X[i]:
		X[i] += H[i]
		H[i] = 0
print(sum((k == 0 for k in H)))


n = int(input())
rIn = lambda : map(int, input().split())
if n <= 2:
	print(n)
else:
	(m, hm) = rIn()
	(r, hr) = rIn()
	total = 2
	for i in range(n - 2):
		l = m
		(m, hm) = (r, hr)
		(r, hr) = rIn()
		if m - hm > l:
			total += 1
		elif m + hm < r:
			total += 1
			m = m + hm
	print(total)


n = int(input())
arr = []
dp = [[0] * 2 for x in range(n)]
for x in range(n):
	arr.append(list(map(int, input().split())))
dp[0][0] = 1
dp[0][1] = 1
for x in range(1, n):
	dp[x][0] = max(dp[x - 1][0] + int(arr[x][0] - arr[x - 1][0] > arr[x][1]), dp[x - 1][1] + int(arr[x][0] - arr[x - 1][0] > arr[x][1] + arr[x - 1][1]))
	dp[x][1] = max(dp[x - 1][0], dp[x - 1][1]) + int(x + 1 >= n or arr[x + 1][0] - arr[x][0] > arr[x][1])
print(dp[-1][-1])


n = int(input())
x = [list(map(int, input().split())) for i in range(n)]
if n == 1:
	print(n)
	quit()
dp = [[0] * 2 for i in range(n)]
dp[0][0] = 1
for i in range(1, n - 1):
	a = x[i - 1][0]
	b = x[i][0]
	c = x[i + 1][0]
	if b - a > x[i][1]:
		dp[i][0] = dp[i - 1][0] + 1
		if b - a > x[i][1] + x[i - 1][1]:
			dp[i][0] = max(dp[i][0], dp[i - 1][1] + 1)
	if c - b > x[i][1]:
		dp[i][1] = max(dp[i - 1][0], dp[i - 1][1]) + 1
	dp[i][0] = max(dp[i][0], dp[i - 1][0], dp[i - 1][1])
print(max(dp[n - 2][0], dp[n - 2][1]) + 1)


(n, ps) = (int(input()), [])
for _ in '0' * n:
	(x, h) = map(int, input().split())
	ps.append((x, h))
ps.append((2 * 10 ** 9 + 1, 1))
(s, e) = (ps[0][0] - ps[0][1], ps[0][0])
for i in range(1, n):
	(x, h) = (ps[i][0], ps[i][1])
	if e < x - h:
		s = x - h
		e = x
	elif ps[i + 1][0] > x + h:
		s = x
		e = x + h
	else:
		s = e = x
		n -= 1
print(n)


value = input('')
n = int(value)
answer = 1
minTrees = 1
maxTrees = pow(10, 9)
if not minTrees <= n <= maxTrees:
	n = 1
mydict = {}
for x in range(0, n):
	mydict[x] = input('')
if n < 3:
	answer = n
else:
	argv = mydict[0].split(' ')
	x = int(argv[0])
	h = int(argv[1])
	lastX = x - h - 1
	treesCut = 0
	for value in mydict:
		argv = mydict[value].split(' ')
		x = int(argv[0])
		h = int(argv[1])
		toLeft = x - h
		if toLeft > lastX:
			treesCut += 1
			lastX = x
		else:
			toRight = x + h
			if len(mydict) > value + 1:
				nextTree = mydict[value + 1].split(' ')
				nextTreeX = int(nextTree[0])
			else:
				nextTreeX = toRight + 1
			if toRight < nextTreeX:
				treesCut += 1
				lastX = toRight
			else:
				lastX = x
	answer = treesCut
print(answer)


n = int(input())
p = []
h = []
for i in range(n):
	(a, b) = map(int, input().split())
	p.append(a)
	h.append(b)
s = 2
for i in range(1, n - 1):
	if p[i] - p[i - 1] > h[i]:
		s += 1
	elif p[i + 1] - p[i] > h[i]:
		p[i] += h[i]
		s += 1
if n == 1:
	print(1)
else:
	print(s)


n = int(input())
(x, z) = (0, 1)
(a, b) = map(int, input().split())
for i in range(n - 1):
	(c, d) = map(int, input().split())
	if x == 1:
		if a + b < c:
			z += 1
			a += b
		x = 0
	if x == 0:
		if c - d > a:
			z += 1
		else:
			x = 1
	(a, b) = (c, d)
if x == 1:
	z += 1
print(z)


n = int(input())
tree_pos = []
tree_len = []
for i in range(n):
	(x, h) = map(int, input().split())
	tree_pos.append(x)
	tree_len.append(h)
if n == 1:
	print(1)
	exit(0)
current = 2
prev = tree_pos[0]
for i in range(1, n - 1):
	if tree_pos[i] - tree_len[i] > prev:
		current += 1
		prev = tree_pos[i]
	elif tree_pos[i] + tree_len[i] < tree_pos[i + 1]:
		current += 1
		prev = tree_pos[i] + tree_len[i]
	else:
		prev = tree_pos[i]
print(current)


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


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


n = int(input())
min_x = -2000000000.0
(x0, h0) = map(int, input().split())
ans = 0
for i in range(n - 1):
	(x, h) = map(int, input().split())
	if x0 - h0 > min_x:
		min_x = x0
		ans += 1
	elif x0 + h0 < x:
		min_x = x0 + h0
		ans += 1
	min_x = max(min_x, x0)
	(x0, h0) = (x, h)
ans += 1
print(ans)


n = int(input())
tree = list()
for i in range(n):
	tree.append(list(map(int, input().split())))
ans = [0] * (n + 1)
ans[0] = [-1]
for i in range(1, n - 1):
	if ans[i - 1] == 1:
		if tree[i - 1][0] + tree[i - 1][1] < tree[i][0] - tree[i][1]:
			ans[i] = -1
		elif tree[i][0] + tree[i][1] < tree[i + 1][0]:
			ans[i] = 1
	elif tree[i - 1][0] < tree[i][0] - tree[i][1]:
		ans[i] = -1
	elif tree[i][0] + tree[i][1] < tree[i + 1][0]:
		ans[i] = 1
ans[-1] = 1
k = 0
for i in range(n):
	if ans[i] == 0:
		k += 1
if n == 1:
	print(1)
else:
	print(n - k + 1)


n = int(input())
arr = []
for i in range(n):
	arr.append(tuple(map(int, input().split())))
right = stay = 0
left = 1
if n > 1 and arr[0][0] + arr[0][1] < arr[1][0]:
	right = 1
for i in range(1, n):
	(nstay, nleft, nright) = (stay, left, right)
	nstay = max(stay, left)
	if arr[i - 1][0] + arr[i - 1][1] < arr[i][0]:
		nstay = max(nstay, right)
	if arr[i][0] - arr[i][1] > arr[i - 1][0]:
		nleft = 1 + max(left, stay)
	if arr[i][0] - arr[i][1] > arr[i - 1][0] + arr[i - 1][1]:
		nleft = max(nleft, 1 + right)
	nright = max(stay, left, right)
	if i + 1 < n and arr[i][0] + arr[i][1] < arr[i + 1][0]:
		nright += 1
	(stay, left, right) = (nstay, nleft, nright)
right += 1
print(max(stay, left, right))


n = int(input())
m = {}
for i in range(n):
	(x, h) = input().split()
	m[int(x)] = int(h)
ans = 0
if n >= 2:
	ans = 2
else:
	ans = 1
a = list(m.keys())
right = a[0]
for i in range(1, len(a) - 1):
	if a[i] - right > m[a[i]]:
		ans += 1
		right = a[i]
	elif a[i + 1] - a[i] > m[a[i]]:
		ans += 1
		right = a[i] + m[a[i]]
	else:
		right = a[i]
print(ans)


z = int(input())
x = []
h = []
if z < 2:
	count = 1
else:
	count = 2
while z > 0:
	l = []
	l = list(map(int, input().split()))
	x.append(l[0])
	h.append(l[1])
	z -= 1
for i in range(1, len(x) - 1):
	if abs(x[i - 1] - x[i]) > h[i]:
		count += 1
	elif abs(x[i + 1] - x[i]) > h[i]:
		count += 1
		x[i] += h[i]
print(count)


import sys
n = int(input())
l = []
for i in range(n):
	(x, y) = map(int, input().split())
	l.append([x, y])
if n <= 2:
	print(n)
	sys.exit(0)
ans = 2
for i in range(1, n - 1):
	if l[i][0] - l[i][1] > l[i - 1][0]:
		ans += 1
	elif l[i][0] + l[i][1] < l[i + 1][0]:
		ans += 1
		l[i][0] += l[i][1]
	else:
		continue
print(ans)


n = int(input())
arr = []
for i in range(n):
	arr.append(list(map(int, input().rstrip().split())))
t = 1
s = arr[0][0]
for i in range(1, n):
	if i + 1 < n:
		if arr[i][0] - arr[i][1] > s:
			s = arr[i][0]
			t += 1
		elif arr[i][0] + arr[i][1] < arr[i + 1][0]:
			s = arr[i][0] + arr[i][1]
			t += 1
		else:
			s = arr[i][0]
t += 1
if n == 1:
	t = 1
print(t)


n = int(input())
x = [0] * n
h = [0] * n
for i in range(n):
	(x[i], h[i]) = map(int, input().split(' '))
space = [0] * (n - 1)
count = 2
for i in range(n - 1):
	space[i] = x[i + 1] - x[i]
for i in range(1, n - 1):
	if h[i] < space[i - 1]:
		count += 1
	elif h[i] < space[i]:
		count += 1
		space[i] -= h[i]
if n == 1:
	count = 1
print(count)


n = int(input())
tree = [[int(x) for x in input().split()] for i in range(n)]
m = 2
for i in range(1, n - 1):
	if tree[i][0] - tree[i][1] > tree[i - 1][0]:
		m += 1
	elif tree[i][0] + tree[i][1] < tree[i + 1][0]:
		m += 1
		tree[i][0] = tree[i][0] + tree[i][1]
if n == 1:
	print(1)
else:
	print(m)


case = int(input())
num = 0
tree = [[0, 0] for i in range(case)]
for i in range(case):
	(tree[i][0], tree[i][1]) = map(int, input().split())
for i in range(1, case - 1):
	if tree[i][0] - tree[i][1] > tree[i - 1][0]:
		num += 1
	elif tree[i][0] + tree[i][1] < tree[i + 1][0]:
		num += 1
		tree[i][0] += tree[i][1]
print([case, num + 2][case >= 2])


n = int(input())
a = []
for i in range(n):
	a.append([int(x) for x in input().split()])
last = -1000000001
res = 0
for i in range(n - 1):
	if a[i][0] - a[i][1] > last:
		last = a[i][0]
		res += 1
	elif a[i][0] + a[i][1] < a[i + 1][0]:
		last = a[i][0] + a[i][1]
		res += 1
	else:
		last = a[i][0]
res += 1
print(res)


import sys
from math import *
import builtins
input = sys.stdin.readline

def print(x, end='\n'):
	sys.stdout.write(str(x) + end)

def get_int():
	return int(input())

def get_list_ints():
	return list(map(int, input().split()))

def get_char_list():
	s = input()
	return list(s[:len(s) - 1])

def get_tuple_ints():
	return tuple(map(int, input().split()))

def print_iterable(p):
	print(' '.join(map(str, p)))

def binary_search(arr, x):
	low = 0
	high = len(arr) - 1
	mid = 0
	while low <= high:
		mid = (high + low) // 2
		if arr[mid] < x:
			low = mid + 1
		elif arr[mid] > x:
			high = mid - 1
		else:
			return mid
	return high

def wood(listc, l):
	if l == 1:
		return 1
	elif l == 2:
		return 2
	else:
		stay = [0, 1]
		if listc[1][0] - listc[0][0] > listc[1][1]:
			left = [1, 2]
		else:
			left = [1, 1]
		right = [1, 2]
		for i in range(2, l):
			if listc[i][0] - listc[i - 1][0] <= listc[i][1]:
				left.append(0)
				if listc[i][0] - listc[i - 1][0] > listc[i - 1][1]:
					right.append(max(stay[i - 1], left[i - 1], right[i - 1]) + 1)
					stay.append(max(stay[i - 1], left[i - 1], right[i - 1]))
				else:
					right.append(max(stay[i - 1], left[i - 1]) + 1)
					stay.append(max(stay[i - 1], left[i - 1]))
			elif listc[i][0] - listc[i - 1][0] > listc[i - 1][1] + listc[i][1]:
				left.append(max(stay[i - 1], left[i - 1], right[i - 1]) + 1)
				right.append(max(stay[i - 1], left[i - 1], right[i - 1]) + 1)
				stay.append(max(stay[i - 1], left[i - 1], right[i - 1]))
			else:
				left.append(max(stay[i - 1], left[i - 1]) + 1)
				if listc[i][0] - listc[i - 1][0] > listc[i - 1][1]:
					right.append(max(stay[i - 1], left[i - 1], right[i - 1]) + 1)
					stay.append(max(stay[i - 1], left[i - 1], right[i - 1]))
				else:
					right.append(max(stay[i - 1], left[i - 1]) + 1)
					stay.append(max(stay[i - 1], left[i - 1]))
		return max(stay[-1], left[-1], right[-1])

def main():
	n = get_int()
	alist = []
	for i in range(n):
		alist.append(get_list_ints())
	print(wood(alist, n))
	pass
main()


n = int(input())
(x, h) = (0, 1)
a = [[0, 0]] * n
for i in range(0, n):
	a[i] = list(map(int, input().split(' ')))
(t, r) = (a[0][x], 1)
for i in range(1, n):
	if a[i][x] - a[i][h] > t:
		(t, r) = (a[i][x], r + 1)
	elif i == n - 1 or a[i][x] + a[i][h] < a[i + 1][x]:
		(t, r) = (a[i][x] + a[i][h], r + 1)
	else:
		t = a[i][x]
print(r)


from sys import stdin
from functools import reduce

def solve(p, segs):
	(left, ans) = p
	((_, h), (right, _)) = segs
	if h <= left:
		return (right, ans + 1)
	if h <= right:
		return (right - h, ans + 1)
	return (right, ans)
n = int(input())
trees = sorted([tuple(map(int, line.split())) for line in stdin.readlines()], key=lambda p: p[0])
if n <= 2:
	print(n)
else:
	segments = list(map(lambda p: (p[1][0] - p[0][0] - 1, p[1][1]), zip(trees, trees[1:])))
	(_, ans) = reduce(solve, zip(segments, segments[1:]), (segments[0][0], 2))
	print(ans)


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())
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]))


import sys
input = sys.stdin.buffer.readline

def prog():
	n = int(input())
	trees = [list(map(int, input().split())) for i in range(n)]
	placed = 1
	last = -10 ** 9 - 1
	for i in range(n - 1):
		if trees[i][0] - trees[i][1] > last:
			last = trees[i][0]
			placed += 1
		elif trees[i][0] + trees[i][1] < trees[i + 1][0]:
			last = trees[i][0] + trees[i][1]
			placed += 1
		else:
			last = trees[i][0]
	print(placed)
prog()


(x, h) = ([], [])
n = int(input())
for i in range(n):
	arr = [int(x) for x in input().split()]
	(xi, hi) = (arr[0], arr[1])
	x.append(xi)
	h.append(hi)
ans = 2
flag = 0
for i in range(1, n - 1):
	gap1 = x[i] - x[i - 1]
	gap2 = x[i + 1] - x[i]
	if gap1 > h[i]:
		ans += 1
	elif gap2 > h[i]:
		x[i] += h[i]
		ans += 1
		flag = 1
if n == 1:
	print(1)
else:
	print(ans)


n = int(input())
ans = 1
x = list()
h = list()
for i in range(n):
	y = input().split()
	x.append(int(y[0]))
	h.append(int(y[1]))
last = x[0]
for i in range(1, n - 1):
	if x[i] - h[i] > last:
		ans += 1
		last = x[i]
	elif x[i] + h[i] < x[i + 1]:
		ans += 1
		last = x[i] + h[i]
	else:
		last = x[i]
print(ans + min(n - 1, 1))


n = int(input())
tree = []
for i in range(n):
	tree.append([int(x) for x in input().split()])
tree.sort(key=lambda x: (x[0], x[1]))
tree.append([2 * 10 ** 9 + 1, 0])
l = 1
if tree[1][0] - tree[0][0] > tree[0][1]:
	r = 1
else:
	r = 0
for j in range(1, n):
	l0 = l
	if tree[j - 1][0] + tree[j - 1][1] < tree[j][0] - tree[j][1]:
		l = max(l + 1, r + 1)
	elif tree[j][0] - tree[j - 1][0] > tree[j][1]:
		l = max(l + 1, r)
	else:
		l = max(l, r)
	if tree[j + 1][0] - tree[j][0] > tree[j][1]:
		r = max(l0 + 1, r + 1)
	else:
		r = max(r, l0)
print(max(l, r))


def main():
	n = int(input())
	a = []
	b = []
	for _ in range(n):
		(x, y) = map(int, input().split())
		a.append(x)
		b.append(y)
	start = a[0]
	cnt = 2
	if n == 1:
		cnt = 1
	for i in range(1, len(a) - 1):
		if start < a[i] - b[i]:
			cnt += 1
			start = a[i]
		elif a[i + 1] > a[i] + b[i]:
			cnt += 1
			start = a[i] + b[i]
		else:
			start = a[i]
	print(cnt)
main()


import sys
input = sys.stdin.readline
n = int(input())
arr = [list(map(int, input().split())) for _ in range(n)]
if n <= 2:
	print(n)
else:
	ans = 0
	for i in range(1, n - 1):
		if arr[i][0] - arr[i][1] > arr[i - 1][0]:
			ans += 1
		elif arr[i][0] + arr[i][1] < arr[i + 1][0]:
			ans += 1
			arr[i][0] += arr[i][1]
	print(ans + 2)


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]
		if s[i][0][1] < l:
			s[i][1] = 'l'
			ans += 1
		elif s[i][0][1] < r:
			s[i][1] = 'r'
			ans += 1
	print(ans)
else:
	print(1)


n = int(input())
if n == 1:
	print(1)
else:
	a = [tuple(map(int, input().split())) for i in range(n)]
	c = 2
	l = a[0][0]
	for i in range(1, n - 1):
		if a[i][0] - a[i][1] > l:
			l = a[i][0]
			c += 1
		elif sum(a[i]) < a[i + 1][0]:
			l = sum(a[i])
			c += 1
		else:
			l = a[i][0]
	print(c)


n = eval(input())
res = 1
tree_pairs = [[0], 0, 0]
if n > 0:
	tree_pairs[0] = [int(i) for i in input().split()]
if n > 1:
	tree_pairs[1] = [int(i) for i in input().split()]
if n > 2:
	for i in range(1, n - 1):
		tree_pairs[2] = [int(i) for i in input().split()]
		if tree_pairs[1][0] - tree_pairs[1][1] > tree_pairs[0][0]:
			res += 1
		elif tree_pairs[1][0] + tree_pairs[1][1] < tree_pairs[2][0]:
			tree_pairs[1][0] += tree_pairs[1][1]
			res += 1
		tree_pairs[0] = tree_pairs[1]
		tree_pairs[1] = tree_pairs[2]
	res += 1
	print(res)
elif n == 1:
	print(1)
elif n == 2:
	print(2)
else:
	print(0)


n = int(input())
c = [list(map(int, input().split())) for _ in range(n)]
d = [0 for _ in range(n)]
r = min(2, len(c))
for i in range(1, n - 1):
	if c[i][0] - c[i][1] > c[i - 1][0]:
		r += 1
	elif c[i][0] + c[i][1] < c[i + 1][0]:
		c[i][0] += c[i][1]
		r += 1
print(r)


n = int(input())
trees = []
c = 1
if n > 1:
	c = 2
for i in range(n):
	(a, b) = map(int, input().split())
	trees.append([a, b])
for i in range(1, n - 1):
	if trees[i][1] < trees[i][0] - trees[i - 1][0]:
		c += 1
	elif trees[i][1] < trees[i + 1][0] - trees[i][0]:
		c += 1
		trees[i][0] += trees[i][1]
	else:
		pass
print(c)


n = int(input())
(x, h) = map(int, input().split(' '))
ans = 1
p = -h - x - 1
for i in range(1, n):
	(xx, hh) = (x, h)
	(x, h) = map(int, input().split(' '))
	if xx - p > hh:
		p = xx
		ans += 1
	elif xx + hh < x:
		p = xx + hh
		ans += 1
	else:
		p = xx
print(ans)


n = int(input())
a = list()
tree = 0
for i in range(0, n):
	l = list(map(int, input().split(' ')))
	a.append(l)
for i in range(1, n - 1):
	if a[i][0] - a[i][1] > a[i - 1][0] and a[i][0] + a[i][1] >= a[i + 1][0]:
		tree = tree + 1
	elif a[i][0] - a[i][1] <= a[i - 1][0] and a[i][0] + a[i][1] < a[i + 1][0]:
		a[i][0] = a[i][0] + a[i][1]
		tree = tree + 1
	elif a[i][0] - a[i][1] > a[i - 1][0] and a[i][0] + a[i][1] < a[i + 1][0]:
		tree = tree + 1
if n > 2:
	print(tree + 2)
else:
	print(n)


n = int(input())
xs = []
hs = []
for _ in range(n):
	(x, h) = list(map(int, input().split()))
	xs.append(x)
	hs.append(h)
ans = min(2, n)
trees_fell = []
for i in range(1, n - 1):
	if xs[i] - hs[i] > xs[i - 1]:
		trees_fell.append(i)
		ans += 1
	elif xs[i] + hs[i] < xs[i + 1]:
		trees_fell.append(i)
		ans += 1
		xs[i] = xs[i] + hs[i]
print(ans)


x = []
h = []
o = 2
n = int(input())
for i in range(n):
	(_, __) = map(int, input().split())
	x.append(_)
	h.append(__)
for i in range(1, n - 1):
	if x[i] - x[i - 1] > h[i]:
		o += 1
	elif x[i + 1] - x[i] > h[i]:
		o += 1
		x[i] += h[i]
print([1, o][n > 1])


n = int(input())
x = []
h = []
for i in range(n):
	ch = input()
	L = [int(i) for i in ch.split()]
	x.append(L[0])
	h.append(L[1])
nx = len(x)
xd = x
nb = 2
for i in range(1, nx - 1):
	if x[i] - h[i] > xd[i - 1]:
		nb += 1
	elif x[i] + h[i] < xd[i + 1]:
		nb += 1
		xd[i] += h[i]
if n == 1:
	print(1)
else:
	print(nb)


import math
import sys

def solve(r, w):
	trees = int(r.readline())
	data = []
	for _ in range(trees):
		line_data = [int(v) for v in r.readline().split()]
		data.append(line_data)
	result = 2
	for i in range(1, trees - 1):
		(location, height) = data[i]
		if location - height > data[i - 1][0]:
			result += 1
		elif location + height < data[i + 1][0]:
			result += 1
			data[i][0] += height
	print(result if trees > 1 else 1)
solve(sys.stdin, sys.stdout)


from sys import stdin
n = int(input())
trees = []
cnt = 2
for i in range(n):
	(x, h) = map(int, input().split())
	trees.append([x, h])
bound = trees[0][0]
for i in range(1, n - 1):
	if trees[i][0] - trees[i][1] > bound:
		cnt += 1
		bound = trees[i][0]
	elif trees[i][0] + trees[i][1] < trees[i + 1][0]:
		cnt += 1
		bound = trees[i][0] + trees[i][1]
	else:
		bound = trees[i][0]
if n == 1:
	print(1)
else:
	print(cnt)


N = int(input())
XH = list()
for _ in range(N):
	XH.append([int(i) for i in input().split(' ')])
XH.insert(0, [XH[0][0] - XH[0][1] - 1, 0])
XH.append([XH[-1][0] + XH[-1][1] + 1, 0])
(a, b) = (0, 0)
for i in range(1, N + 1):
	if XH[i][0] - XH[i][1] > XH[i - 1][0] + XH[i - 1][1]:
		_a = max(a, b) + 1
	elif XH[i][0] - XH[i][1] > XH[i - 1][0]:
		_a = max(a + 1, b)
	else:
		_a = max(a, b)
	if XH[i][0] + XH[i][1] < XH[i + 1][0]:
		_b = max(a, b) + 1
	else:
		_b = 0
	(a, b) = (_a, _b)
print(max(a, b))


n = int(input())
point = []
dp = [-10000000000, 0, 0]
c = 0
for i in range(n):
	(a, b) = map(int, input().split())
	point.append([a, b])
point.append([10000000000, 0])
for i in range(n):
	if dp[0] < point[i][0] - point[i][1]:
		dp[1] += 1
		dp[0] = point[i][0]
	elif point[i][0] + point[i][1] < point[i + 1][0]:
		dp[0] = point[i][0] + point[i][1]
		dp[2] += 1
	else:
		dp[0] = point[i][0]
print(dp[1] + dp[2])


from math import inf
n = int(input())
x1 = x2 = -inf
c1 = c2 = 0
for _ in range(n):
	(x, h) = map(int, input().split())
	if x2 + h < x:
		x1 = x2 = x
		c1 = c2 = max(c1, c2) + 1
	elif x1 + h < x:
		if x2 >= x:
			c2 = -10
		(x1, x2) = (x, x + h)
		(c1, c2) = (max(c1 + 1, c2), max(c1, c2) + 1)
	else:
		if x2 >= x:
			c2 = -10
		(x1, x2) = (x, x + h)
		(c1, c2) = (max(c1, c2), max(c1, c2) + 1)
print(max(c1, c2))


n = int(input())
f = [[*map(int, input().split())] for i in range(n)]
current = f[0][0]
ans = 0
for i in range(1, n - 1):
	if f[i][0] - current > f[i][1]:
		current = f[i][0]
		ans += 1
		continue
	if sum(f[i]) < f[i + 1][0]:
		current = sum(f[i])
		ans += 1
		continue
	current = f[i][0]
print(min(n, ans + 2))


n = int(input())
tree = []
output = 2
for i in range(n):
	(a, b) = map(int, input().split())
	tree.append([a, b])
start = tree[0][0]
for i in range(1, n - 1):
	h = tree[i][1]
	if tree[i][0] - h > start:
		output += 1
		start = tree[i][0]
	elif tree[i][0] + h < tree[i + 1][0]:
		output += 1
		start = tree[i][0] + h
	else:
		start = tree[i][0]
print(min(output, n))


n = int(input())
a = list((list(map(lambda x: int(x), list(input().split(' ')))) for i in range(n)))
curr = a[0][0]
ans = 1
for i in range(1, n):
	if a[i][0] - a[i][1] > curr:
		ans += 1
		curr = a[i][0]
	elif i == n - 1 or a[i][0] + a[i][1] < a[i + 1][0]:
		ans += 1
		curr = a[i][0] + a[i][1]
	else:
		curr = a[i][0]
print(ans)


n = int(input())
xh = []
t = 0
while t < n:
	A = list(map(int, input().split()))
	xh.append(A)
	t = t + 1
space = [xh[i][0] - xh[i - 1][0] for i in range(1, n)] + [10000000000]
a = 1
i = 1
while i < n:
	if xh[i][1] < space[i - 1]:
		a += 1
	elif xh[i][1] < space[i]:
		a = a + 1
		space[i] -= xh[i][1]
	i = i + 1
print(a)


n = int(input())
xs = [0] * n
hs = [0] * n
ls = [1] * n
rs = [1] * n
for i in range(n):
	(xs[i], hs[i]) = map(int, input().split())
if n > 1 and xs[1] - xs[0] <= hs[0]:
	rs[0] = 0
for i in range(1, n):
	rs[i] = max(rs[i - 1], ls[i - 1])
	if i == n - 1 or xs[i + 1] - xs[i] > hs[i]:
		rs[i] += 1
	if xs[i] - xs[i - 1] - hs[i - 1] > hs[i]:
		ls[i] = max(rs[i - 1] + 1, ls[i - 1] + 1)
	elif xs[i] - xs[i - 1] > hs[i]:
		ls[i] = max(rs[i - 1], ls[i - 1] + 1)
	else:
		ls[i] = max(rs[i - 1], ls[i - 1])
print(max(rs[-1], ls[-1]))


n = int(input())
maxTree = 2
pos = []
height = []
for trees in range(n):
	(x, h) = map(int, input().split())
	pos.append(x)
	height.append(h)
if n == 1:
	print(1)
else:
	ocupado = [pos[0]]
	for i in range(1, len(pos) - 1):
		if pos[i] - height[i] > ocupado[-1]:
			maxTree += 1
			ocupado.append(pos[i])
		elif pos[i] + height[i] < pos[i + 1]:
			maxTree += 1
			ocupado.append(pos[i] + height[i])
		else:
			ocupado.append(pos[i])
	print(maxTree)


from collections import defaultdict, deque, Counter, OrderedDict
from heapq import heappop, heappush

def main():
	(n, ans) = (int(input()), 2)
	a = [tuple(map(int, input().split())) for i in range(n)]
	last = a[0][0]
	ans = min(2, n)
	for i in range(1, n - 1):
		if a[i][0] - a[i][1] > last:
			ans += 1
			last = a[i][0]
		elif a[i][0] + a[i][1] < a[i + 1][0]:
			last = a[i][0] + a[i][1]
			ans += 1
		else:
			last = a[i][0]
	print(ans)
main()


n = int(input())
b = [(float('-inf'), 0)]
for _ in range(n):
	b.append(tuple(map(int, input().split())))
b.append((float('inf'), 0))
d = [[0, 0, 0]] + [[0, 0, 0] for _ in range(n)]
for i in range(1, n + 1):
	if b[i - 1][0] < b[i][0] - b[i][1]:
		d[i][0] = max(d[i - 1][0], d[i - 1][1]) + 1
		if b[i - 1][0] + b[i - 1][1] < b[i][0] - b[i][1]:
			d[i][0] = max(d[i][0], d[i - 1][2] + 1)
	else:
		d[i][0] = -1
	d[i][1] = max(d[i - 1])
	if b[i + 1][0] > b[i][0] + b[i][1]:
		d[i][2] = max(d[i - 1]) + 1
	else:
		d[i][2] = -1
print(max(d[n]))


N = int(input())
X = []
H = []
for i in range(N):
	(x, h) = map(int, input().split())
	X.append(x)
	H.append(h)
dp = [[1 for i in range(3)] for j in range(N)]
for i in range(1, N):
	if X[i - 1] + H[i - 1] < X[i]:
		dp[i][0] = dp[i - 1][2]
	else:
		dp[i][0] = dp[i - 1][0]
	if X[i - 1] + H[i - 1] < X[i] - H[i]:
		dp[i][1] = dp[i - 1][2] + 1
	elif X[i] - H[i] > X[i - 1]:
		dp[i][1] = max(dp[i - 1][0] + 1, dp[i - 1][1] + 1)
	else:
		dp[i][1] = max(dp[i - 1][0], dp[i - 1][1])
	if X[i - 1] + H[i - 1] < X[i]:
		dp[i][2] = dp[i - 1][2] + 1
	else:
		dp[i][2] = max(dp[i - 1][0] + 1, dp[i - 1][1] + 1)
print(max(dp[-1][0], dp[-1][1], dp[-1][2]))


from math import inf
n = int(input())
a = []
for i in range(n):
	(x, h) = map(int, input().split())
	a.append([x, h])
a.append([inf, inf])
count = 0
prev = -inf
for i in range(n):
	(x, h) = a[i]
	if prev < x - h:
		count += 1
		prev = x
	elif x + h < a[i + 1][0]:
		count += 1
		prev = x + h
	else:
		prev = x
print(count)


LEFT = 1
RIGHT = 2
n = int(input())
trees = []
for i in range(n):
	a = input().split(' ')
	trees.append([int(a[0]), int(a[1]), None])
count = 0
for i in range(len(trees)):
	if i == 0:
		count += 1
		trees[i][2] = LEFT
		continue
	if i == len(trees) - 1:
		count += 1
		trees[i][2] = RIGHT
		continue
	pr = trees[i - 1]
	ne = trees[i + 1]
	dl = trees[i][0] - trees[i][1]
	dr = trees[i][0] + trees[i][1]
	if pr[2] == LEFT or pr[2] == None:
		if dl > pr[0]:
			trees[i][2] = LEFT
			count += 1
			continue
	elif dl > pr[0] + pr[1]:
		trees[i][2] = LEFT
		count += 1
		continue
	if ne[2] == RIGHT or ne[2] == None:
		if dr < ne[0]:
			trees[i][2] = RIGHT
			count += 1
			continue
print(count)


n = int(input())
x = []
h = []
for i in range(n):
	(a, b) = map(int, input().split())
	x.append(a)
	h.append(b)
count = 1
for i in range(1, n):
	if x[i] - h[i] > x[i - 1]:
		count += 1
	elif i == n - 1:
		count += 1
	elif x[i] + h[i] < x[i + 1]:
		count += 1
		x[i] = x[i] + h[i]
print(count)


n = int(input())
(l, nl) = (-10 ** 10, 0)
(r, nr) = (-10 ** 10, 0)
for i in range(n):
	(x, h) = [int(x) for x in input().split()]
	left = x - h
	right = x + h
	if left > r:
		new_nl = nr + 1
	elif left > l:
		new_nl = nl + 1
	elif x > r:
		new_nl = nr
	else:
		new_nl = nl
	new_l = x
	if x > r:
		new_nr = nr + 1
	else:
		new_nr = nl + 1
	new_r = right
	(l, nl, r, nr) = (new_l, new_nl, new_r, new_nr)
print(max(nl, nr))


def solve(n, x, h):
	out = min(n, 2)
	endpt = x[0]
	for i in range(1, n - 1):
		if max(x[i - 1], endpt) < x[i] - h[i]:
			out += 1
			endpt = x[i]
		elif x[i] + h[i] < x[i + 1]:
			out += 1
			endpt = x[i] + h[i]
	return out
n = int(input())
x = []
h = []
for i in range(n):
	(xi, hi) = map(int, input().split())
	x.append(xi)
	h.append(hi)
print(solve(n, x, h))


def can_cut_left(C, H, i, n):
	return C[i - 1] < C[i] - H[i]

def can_cut_right(C, H, i, n):
	if i == n:
		return True
	return C[i] + H[i] < C[i + 1]

def can_cut_left_if_right(C, H, i, n):
	return C[i - 1] + H[i - 1] < C[i] - H[i]

def main():
	n = int(input())
	C = [0] * (n + 1)
	H = [0] * (n + 1)
	for i in range(1, n + 1):
		(c, h) = map(int, input().split())
		C[i] = c
		H[i] = h
	dp = [[0 for _ in range(3)] for _ in range(n + 1)]
	for j in range(3):
		dp[0][j] = 0
	dp[1][0] = 1
	dp[1][1] = 0
	dp[1][2] = 1 if can_cut_right(C, H, 1, n) else 0
	for i in range(2, n + 1):
		for j in range(3):
			if j == 0:
				if can_cut_left(C, H, i, n):
					if can_cut_left_if_right(C, H, i, n):
						dp[i][j] = 1 + max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
					else:
						dp[i][j] = 1 + max(dp[i - 1][0], dp[i - 1][1])
				elif can_cut_right(C, H, i - 1, n):
					dp[i][j] = max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
				else:
					dp[i][j] = max(dp[i - 1][0], dp[i - 1][1])
			elif j == 1:
				if can_cut_right(C, H, i - 1, n):
					dp[i][j] = max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
				else:
					dp[i][j] = max(dp[i - 1][0], dp[i - 1][1])
			elif can_cut_right(C, H, i, n):
				dp[i][j] = 1 + max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
			else:
				dp[i][j] = max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
	m = max(dp[n][0], dp[n][1], dp[n][2])
	print(m)
main()


t = []
hi = []
u = 2
n = int(input())
for j in range(n):
	(x, h) = map(int, input().split())
	t.append(x)
	hi.append(h)
if n == 1:
	print(1)
elif n == 2:
	print(2)
else:
	for j in range(1, n - 1):
		if t[j] - t[j - 1] >= hi[j] + 1:
			u += 1
		elif t[j + 1] - t[j] >= hi[j] + 1:
			u += 1
			t[j] = t[j] + hi[j]
	print(u)


n = int(input())
trees = []
for i in range(n):
	values = input().split(' ')
	trees.append([int(values[0]), int(values[1])])
fallen = 2 if n > 2 else n
for i in range(1, n - 1):
	if trees[i][0] - trees[i - 1][0] - 1 >= trees[i][1] and trees[i][0] - trees[i - 1][0] - 1 > 0:
		fallen += 1
	elif trees[i + 1][0] - trees[i][0] - 1 >= trees[i][1] and trees[i + 1][0] - trees[i][0] - 1 > 0:
		fallen += 1
		trees[i][0] += trees[i][1]
print(fallen)


n = int(input())
xh = []
for i in range(n):
	(x, h) = [int(x) for x in input().split()]
	xh.append((x, h))
count = 2
pre = xh[0][0]
if n == 1:
	print(1)
elif n == 2:
	print(2)
else:
	for i in range(1, n - 1):
		if xh[i][0] - xh[i][1] > pre:
			count += 1
			pre = xh[i][0]
			continue
		if sum(xh[i]) < xh[i + 1][0]:
			count += 1
			pre = sum(xh[i])
			continue
		pre = xh[i][0]
	print(count)


n = int(input())
if n == 1:
	print(1)
	exit(0)
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)]
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):
	dp[x][S] = max(dp[x - 1][L], dp[x - 1][S], dp[x - 1][R])
	if a[x] - h[x] > a[x - 1]:
		dp[x][L] = max(dp[x - 1][L], dp[x - 1][S])
		if a[x - 1] + h[x - 1] < a[x] - h[x]:
			dp[x][L] = max(dp[x][L], dp[x - 1][R])
		dp[x][L] += 1
	else:
		dp[x][L] = max(dp[x - 1][L], dp[x - 1][S], dp[x - 1][R])
	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]))


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


n = int(input())
xs = []
hs = []
for _ in range(n):
	(x, h) = map(int, input().split())
	xs.append(x)
	hs.append(h)
r = 1 if n == 1 else 2
for i in range(1, n - 1):
	(x, h) = (xs[i], hs[i])
	if x - h > xs[i - 1]:
		r += 1
	elif x + h < xs[i + 1]:
		r += 1
		xs[i] += h
print(r)


r = int(input())
if r == 1:
	print(1)
else:
	l1 = []
	l2 = []
	for i in range(r):
		(x, h) = map(lambda x: int(x), input().split())
		l1.append(x)
		l2.append(h)
	c = 0
	w = 2
	for i in range(1, len(l1) - 1):
		d = l1[i] - l1[i - 1] - c
		if d <= l2[i]:
			d1 = l1[i + 1] - l1[i]
			if d1 > l2[i]:
				c = l2[i]
				w += 1
			else:
				c = 0
		else:
			w += 1
			c = 0
	print(w)


n = int(input())
x = []
h = []
for i in range(n):
	(a, b) = map(int, input().split())
	x.append(a)
	h.append(b)
INF = -10 ** 9
stay = [INF] * (n + 1)
left = [INF] * (n + 1)
right = [INF] * (n + 1)
stay[-1] = 0
left[-1] = 0
right[-1] = 0
for i in range(n):
	stay[i] = max(stay[i - 1], left[i - 1], right[i - 1])
	if i == 0 or x[i - 1] + h[i - 1] < x[i] - h[i]:
		left[i] = right[i - 1] + 1
	if i == 0 or x[i] - h[i] > x[i - 1]:
		left[i] = max(left[i], left[i - 1] + 1, stay[i - 1] + 1)
	if i == n - 1 or x[i] + h[i] < x[i + 1]:
		right[i] = max(left[i - 1], right[i - 1], stay[i - 1]) + 1
print(max(left[n - 1], right[n - 1], stay[n - 1]))


n = int(input())
L = []
for _ in range(n):
	(a, b) = [int(x) for x in input().split()]
	L.append((a, b))
tree = n - 1
right = 10 ** 10
ans = 0
while tree >= 1:
	if L[tree][0] + L[tree][1] < right:
		ans += 1
		right = L[tree][0]
		tree -= 1
	elif L[tree][0] - L[tree][1] > L[tree - 1][0]:
		ans += 1
		right = L[tree][0] - L[tree][1]
		tree -= 1
	else:
		right = L[tree][0]
		tree -= 1
print(ans + 1)


import sys
import collections
import math
import functools
import itertools
import bisect
import operator
import heapq
import random
true = True
false = False
null = None
SLOW = True
memoi = functools.lru_cache(None)
tcid = 0
tcmax = 99999999

def fast():
	SLOW = False

def compute(val, func):
	return func(val)

def seq(lo, hi, step=1):
	return range(lo, hi + 1, step)

def sround(val, nd):
	return f'{val:.{nd}f}'

def ceil(a, b):
	ans = a // b
	if a % b != 0:
		ans += 1
	return ans

def perr(*args, **kwargs):
	if SLOW:
		print(*args, file=sys.stderr, **kwargs)

def line():
	ln = sys.stdin.readline().strip()
	if ln == '':
		sys.exit()
	return ln

def lines(n):
	return [line() for i in range(n)]

def split(ln=None):
	return (ln or line()).split()

def num(str=None):
	str = str or line()
	return float(str) if '.' in str else int(str)

def nums(o=None):
	if o is not None:
		if isinstance(o, int):
			o = lines(o)
		elif isinstance(o, str):
			o = split(o)
	return list(map(num, o or split()))

def mainloop(tcid=1):

	def solve():
		n = num()
		lft = []
		rgt = []
		hei = []
		for ln in lines(n):
			(x, h) = nums(ln)
			lft.append(x)
			rgt.append(x)
			hei.append(h)
		if n < 3:
			return n
		up = [true] * n
		up[0] = up[-1] = false
		for ii in range(1, n - 1):
			if up[ii]:
				if lft[ii] - hei[ii] > rgt[ii - 1]:
					up[ii] = false
					lft[ii] -= hei[ii]
				elif rgt[ii] + hei[ii] < lft[ii + 1]:
					up[ii] = false
					rgt[ii] += hei[ii]
		return up.count(false)
	ans = solve()
	print(ans)
while tcid < tcmax:
	tcid += 1
	mainloop(tcid)


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
n = int(input())
la = []
for i in range(n):
	(a, b) = map(int, input().split())
	la.append([a, b])
(x, y) = la[0]
(a, b) = (x - y, x)
cnt = 2
for i in range(1, n - 1):
	(x, y) = la[i]
	if x - y > b and x - y > la[i - 1][0]:
		(a, b) = (x - y, x)
		cnt += 1
	elif x > b and x + y < la[i + 1][0]:
		(a, b) = (x, x + y)
		cnt += 1
if n == 1:
	print(1)
	exit()
print(cnt)


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())
tree_pos = []
tree_height = []
tree_falls_in = []
fallen_trees = 0
for t in range(n):
	(pos, height) = map(int, input().strip().split())
	tree_pos.append(pos)
	tree_height.append(height)
	tree_falls_in.append(pos)
tree_falls_in[0] = tree_pos[0] - tree_height[0]
fallen_trees += 1
for t in range(1, n):
	if tree_pos[t] - tree_height[t] > max(tree_pos[t - 1], tree_falls_in[t - 1]):
		tree_falls_in[t] = tree_pos[t] - tree_height[t]
		fallen_trees += 1
	elif t == n - 1:
		fallen_trees += 1
	elif tree_pos[t] + tree_height[t] < tree_pos[t + 1]:
		tree_falls_in[t] = tree_pos[t] + tree_height[t]
		fallen_trees += 1
print(fallen_trees)


n = int(input())
list0 = []
for i in range(n):
	(xi, hi) = map(int, input().split())
	list0.append((xi, hi))
list0.sort()
if len(list0) == 1:
	print(1)
elif len(list0) == 2:
	print(2)
else:
	k = list0[0][0]
	num = 2
	for i in range(1, n - 1):
		if list0[i][0] - list0[i][1] > k:
			num += 1
			k = list0[i][0]
		elif list0[i][0] + list0[i][1] < list0[i + 1][0]:
			num += 1
			k = list0[i][0] + list0[i][1]
		else:
			k = list0[i][0]
	print(num)


n = int(input())
a = []
for i in range(n):
	(x, h) = map(int, input().split())
	a.append([x, h])
s = 0
i = 0
e = 0
while i < len(a):
	if i == 0:
		s = s + 1
	elif i == len(a) - 1:
		s = s + 1
		break
	elif abs(a[i][0] - a[i - 1][0]) > a[i][1]:
		s = s + 1
	elif abs(a[i + 1][0] - a[i][0]) > a[i][1]:
		a[i][0] = a[i][0] + a[i][1]
		s = s + 1
	i = i + 1
print(s)


n = int(input())
(x, h) = map(int, input().split())
a = [[[x, 1], [x, 0], [x + h, 1]]]
for i in range(1, n):
	(x, h) = map(int, input().split())
	tree = [[-1, -1] for j in range(3)]
	left_i = x - h
	if a[-1][0][0] >= left_i:
		tree[0] = [x, -1]
	else:
		tree[0] = [x, max(a[-1][0][1], a[-1][1][1]) + 1]
	if a[-1][2][0] < left_i:
		tree[0] = [x, max(tree[0][1], a[-1][2][1] + 1)]
	tree[1] = [x, max(a[-1][0][1], a[-1][1][1])]
	tree[2] = [x + h, tree[1][1] + 1]
	if a[-1][2][0] < x:
		tree[1] = [x, max(tree[1][1], a[-1][2][1])]
		tree[2] = [x + h, tree[1][1] + 1]
	a.append(tree)
print(max(a[-1][0][1], a[-1][1][1], a[-1][2][1]))


n = int(input())
trees = [list(map(int, input().split())) for _ in range(n)]
c = min(2, n)
for i in range(1, n - 1):
	if trees[i][0] - trees[i][1] > trees[i - 1][0]:
		c += 1
	elif trees[i][0] + trees[i][1] < trees[i + 1][0]:
		trees[i][0] += trees[i][1]
		c += 1
print(c)


def solve(n, trees, heights):
	state = {tree: [1, 1, tree] for tree in trees}
	for i in range(1, n):
		tree = trees[i]
		height = heights[i]
		if trees[i] - heights[i] > trees[i - 1] + heights[i - 1]:
			maxLeft = max(state[trees[i - 1]][:2]) + 1
		elif trees[i] - heights[i] > trees[i - 1]:
			maxLeft = state[trees[i - 1]][0] + 1
		else:
			maxLeft = max(state[trees[i - 1]][:2])
		fallToRightable = ableToFallRight(i, n, trees, heights)
		maxRight = max(state[trees[i - 1]][:2]) + fallToRightable
		if fallToRightable == 1:
			lengthRight = tree + height
		else:
			lengthRight = tree
		state[tree] = [maxLeft, maxRight, lengthRight]
	return max(state[trees[-1]][:2])

def ableToFallRight(index, n, trees, heights):
	if index == n - 1:
		return 1
	if trees[index] + heights[index] >= trees[index + 1]:
		return 0
	return 1

def run():
	n = int(input())
	trees = []
	heights = []
	for i in range(n):
		inputString = input()
		inputs = inputString.split()
		trees.append(int(inputs[0]))
		heights.append(int(inputs[1]))
	print(solve(n, trees, heights))
run()


n = int(input())
x = list()
h = list()
for i in range(n):
	(a, b) = map(int, input().split())
	x.append(a)
	h.append(b)
cn = 1
for i in range(1, len(x) - 1):
	if x[i] - x[i - 1] > h[i]:
		cn += 1
	elif x[i + 1] - x[i] > h[i]:
		cn += 1
		x[i] = x[i] + h[i]
if n != 1:
	print(cn + 1)
else:
	print(cn)


inp = lambda : map(int, input().rstrip().split())
li = []
n = int(input())
for i in range(n):
	li += [list(inp())]
li.sort(key=lambda x: x[0])
last = li[0][0]
c = min(2, n)
for i in range(1, n - 1):
	x = li[i][0]
	y = li[i][1]
	z = li[i + 1][0]
	if x - y > last:
		last = x
		c += 1
	elif x + y < z:
		last = x + y
		c += 1
	else:
		last = x
print(c)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from functools import cmp_to_key
from heapq import *
from math import gcd, factorial, floor, ceil, sqrt
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	y %= p - 1
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
inf = pow(10, 20)
mod = 998244353

def bucketsort(order, seq):
	buckets = [0] * (max(seq) + 1)
	for x in seq:
		buckets[x] += 1
	for i in range(len(buckets) - 1):
		buckets[i + 1] += buckets[i]
	new_order = [-1] * len(seq)
	for i in reversed(order):
		x = seq[i]
		idx = buckets[x] = buckets[x] - 1
		new_order[idx] = i
	return new_order

def ordersort(order, seq, reverse=False):
	bit = max(seq).bit_length() >> 1
	mask = (1 << bit) - 1
	order = bucketsort(order, [x & mask for x in seq])
	order = bucketsort(order, [x >> bit for x in seq])
	if reverse:
		order.reverse()
	return order

def long_ordersort(order, seq):
	order = ordersort(order, [int(i & 2147483647) for i in seq])
	return ordersort(order, [int(i >> 31) for i in seq])

def multikey_ordersort(order, *seqs, sort=ordersort):
	for i in reversed(range(len(seqs))):
		order = sort(order, seqs[i])
	return order
dp = [[-1, -1, -1] for i in range(100010)]

@iterative
def rec(pos, type):
	global p, h
	if pos >= len(p):
		yield 0
	if dp[pos][type] != -1:
		yield dp[pos][type]
	temp = 0
	temp = max(temp, (yield rec(pos + 1, 1)))
	if type == 0:
		if p[pos] - h[pos] > p[pos - 1]:
			temp = max(temp, 1 + (yield rec(pos + 1, 0)))
		if pos == len(p) - 1 or p[pos + 1] > p[pos] + h[pos]:
			temp = max(temp, 1 + (yield rec(pos + 1, 2)))
	if type == 2:
		if p[pos - 1] + h[pos - 1] < p[pos] - h[pos]:
			temp = max(temp, 1 + (yield rec(pos + 1, 0)))
		if pos == len(p) - 1 or p[pos + 1] > p[pos] + h[pos]:
			temp = max(temp, 1 + (yield rec(pos + 1, 2)))
	if type == 1:
		if pos == 0 or p[pos - 1] < p[pos] - h[pos]:
			temp = max(temp, 1 + (yield rec(pos + 1, 0)))
		if pos == len(p) - 1 or p[pos + 1] > p[pos] + h[pos]:
			temp = max(temp, 1 + (yield rec(pos + 1, 2)))
	dp[pos][type] = temp
	yield temp

def solve(case):
	n = int(inp())
	(a, b) = ([], [])
	for i in range(n):
		(x, y) = sep()
		a.append(x)
		b.append(y)
	order = multikey_ordersort(range(n), a, b)
	global p, h
	p = []
	h = []
	for i in order:
		p.append(a[i])
		h.append(b[i])
	print(rec(0, 1))
p = []
h = []
testcase(1)


import sys
import bisect
input = sys.stdin.readline

def takeSecond(elem):
	return elem[1]
t = 1
for _ in range(t):
	n = int(input())
	l = []
	for i in range(n):
		l.append(list(map(int, input().split())))
	ans = 1
	prevl = l[0][0]
	for i in range(1, n):
		if l[i][0] - l[i][1] > prevl:
			prevl = l[i][0]
			ans += 1
		elif i < n - 1:
			if l[i][0] + l[i][1] < l[i + 1][0]:
				prevl = l[i][1] + l[i][0]
				ans += 1
			else:
				prevl = l[i][0]
		else:
			ans += 1
	print(ans)


n = int(input())
a = []
b = []
c = 2
for i in range(n):
	(x, y) = map(int, input().split())
	a.append(x)
	b.append(y)
for i in range(1, n - 1):
	if a[i] - a[i - 1] > b[i]:
		c += 1
	elif a[i + 1] - a[i] > b[i]:
		a[i] += b[i]
		c += 1
if n == 1:
	print(1)
else:
	print(c)


def solve(n, trees):
	big = float('inf')
	small = float('-inf')
	res = 1
	trees[0].append('L')
	trees.append([big, big])
	for i in range(1, n):
		flag = True
		if trees[i - 1][-1] != 'R':
			if trees[i][0] - trees[i][1] > trees[i - 1][0]:
				flag = False
				res += 1
				trees[i].append('L')
		if flag:
			if trees[i - 1][-1] == 'R' and trees[i][0] - trees[i][1] > trees[i - 1][0] + trees[i - 1][1]:
				res += 1
				trees[i].append('L')
			elif trees[i][0] + trees[i][1] < trees[i + 1][0]:
				res += 1
				trees[i].append('R')
	return res

def main():
	t = int(input())
	trees = []
	for i in range(t):
		d = input()
		d = [int(i) for i in d.split()]
		a = d[0]
		b = d[1]
		trees.append([a, b])
	ans = solve(t, trees)
	print(ans)
main()
x = [0]


def num_trees(n, x, h):
	if n < 3:
		return n
	dp = [[0, 0] for i in range(n - 1)]
	dp[0] = [1, x[0]]
	for i in range(1, n - 1):
		if x[i] - h[i] < x[i - 1] and x[i] + h[i] > x[i + 1]:
			dp[i] = [dp[i - 1][0], x[i]]
		elif x[i] - h[i] > x[i - 1] and x[i] - h[i] > dp[i - 1][1]:
			dp[i] = [dp[i - 1][0] + 1, x[i]]
		elif x[i] + h[i] < x[i + 1]:
			dp[i] = [dp[i - 1][0] + 1, x[i] + h[i]]
		else:
			dp[i] = [dp[i - 1][0], x[i]]
	return dp[n - 2][0] + 1
n = int(input())
(x, h) = ([], [])
for _ in range(n):
	(a, b) = [int(i) for i in input().split(' ')]
	x.append(a)
	h.append(b)
print(num_trees(n, x, h))


n = int(input())
l = []
m = []
c = 2
if n == 1:
	print('1')
	exit()
for _ in range(n):
	(a, b) = map(int, input().split())
	l.append(a)
	m.append(b)
for i in range(1, n - 1):
	if m[i] < abs(l[i] - l[i - 1]):
		c = c + 1
	elif m[i] < abs(l[i] - l[i + 1]):
		c = c + 1
		l[i] += m[i]
print(c)


n = int(input())
a = list()
for i in range(n):
	a.append(list(map(int, input().split())))
a.append([1e+20, 1e+20])
ans = 1
i = 1
while i < n:
	if a[i][0] - a[i][1] > a[i - 1][0]:
		ans += 1
	elif a[i][0] + a[i][1] < a[i + 1][0]:
		ans += 1
		a[i][0] += a[i][1]
	i += 1
print(ans)


n = int(input())
l = []
for num in range(n):
	string = input().split(' ')
	(x, y) = (int(string[0]), int(string[1]))
	l.append((x, y))
if n > 1:
	count = 2
else:
	count = 1
space_occupied = ['left']
for num in range(1, len(l) - 1):
	if l[num][0] - l[num - 1][0] > l[num][1] and space_occupied[num - 1] != 'right':
		count += 1
		space_occupied.append('left')
	elif l[num][0] - l[num - 1][0] > l[num][1] + l[num - 1][1]:
		count += 1
		space_occupied.append('left')
	elif l[num + 1][0] - l[num][0] > l[num][1]:
		count += 1
		space_occupied.append('right')
	else:
		space_occupied.append('None')
print(count)


n = int(input())
(px, ph, pd) = (-1, -1, -1)
r = 0
for i in range(n):
	(x, h) = map(int, input().split())
	if i == 0:
		(px, ph, pd) = (x, h, -1)
	else:
		if px + ph * pd >= x:
			pd = 0
		if pd != 0:
			r += 1
		if max(px + ph * pd, px) < x - h:
			pd = -1
		else:
			pd = 1
		(px, ph) = (x, h)
print(r + 1)


def ans(a):
	if len(a) == 1:
		return 1
	else:
		c = 2
		for i in range(1, len(a) - 1):
			if a[i][0] - a[i - 1][0] > a[i][1]:
				c = c + 1
			elif a[i + 1][0] - a[i][0] > a[i][1]:
				c = c + 1
				a[i][0] = a[i][0] + a[i][1]
			else:
				pass
		return c
d = []
n = int(input())
for j in range(n):
	a = input().split()
	if True:
		a = [int(i) for i in a]
		d.append(a)
print(ans(d))


n = int(input())
s = [[int(x) for x in input().split()] for i in range(n)]
count = 2
if n == 1:
	print(1)
else:
	for i in range(1, n - 1):
		if s[i][0] - s[i - 1][0] > s[i][1]:
			count += 1
		elif s[i + 1][0] - s[i][0] > s[i][1]:
			count += 1
			s[i][0] += s[i][1]
	print(count)


n = int(input())
a = []
b = []
count = 2
for i in range(n):
	(x, y) = map(int, input().split())
	a.append(x)
	b.append(y)
for i in range(n):
	if i > 0 and i < n - 1:
		if a[i] - a[i - 1] > b[i]:
			count += 1
		elif a[i + 1] - a[i] > b[i]:
			a[i] += b[i]
			count += 1
if n == 1:
	print(1)
else:
	print(count)


n = int(input())
x = []
h = []
dx = []
for i in range(n):
	(a, b) = map(int, input().split())
	x.append(a)
	h.append(b)
if n == 1 or n == 2:
	print(n)
else:
	for j in range(n - 1):
		dx.append(x[j + 1] - x[j])
	m = 2
	for k in range(1, n - 1):
		if h[k] < dx[k - 1]:
			m += 1
		elif h[k] < dx[k]:
			m += 1
			dx[k] -= h[k]
	print(m)


from math import *
from sys import stdin, stdout
import itertools, os, sys, threading
from collections import deque, Counter, OrderedDict, defaultdict
from heapq import *
from fractions import Fraction

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def fii():
	return int(stdin.readline())

def fsi():
	return str(stdin.readline())

def fmi():
	return map(int, stdin.readline().split())

def fli():
	return list(fmi())
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y, z) = mi()
		if x not in d:
			d[x] = [[z, y]]
		else:
			d[x].append([z, y])
		if y not in d:
			d[y] = [[z, x]]
		else:
			d[y].append([z, x])
	return d

def gr2(n):
	d = defaultdict(list)
	for i in range(n):
		(x, y) = mi()
		d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(i)
			n = n // i
	if n > 2:
		s.add(n)
	return s

def find_all(a_str, sub):
	start = 0
	while True:
		start = a_str.find(sub, start)
		if start == -1:
			return
		yield start
		start += len(sub)

def SieveOfEratosthenes(n, isPrime):
	isPrime[0] = isPrime[1] = False
	for i in range(2, n + 1):
		isPrime[i] = True
	p = 2
	while p * p <= n:
		if isPrime[p] == True:
			i = p * p
			while i <= n:
				isPrime[i] = False
				i += p
		p += 1
	return isPrime

def dijkstra(edges, f, t):
	g = defaultdict(list)
	for (l, r, c) in edges:
		g[l].append((c, r))
	(q, seen, mins) = ([(0, f, ())], set(), {f: 0})
	while q:
		(cost, v1, path) = heappop(q)
		if v1 not in seen:
			seen.add(v1)
			path = (v1, path)
			if v1 == t:
				return (cost, path)
			for (c, v2) in g.get(v1, ()):
				if v2 in seen:
					continue
				prev = mins.get(v2, None)
				next = cost + c
				if prev is None or next < prev:
					mins[v2] = next
					heappush(q, (next, v2, path))
	return float('inf')
n = fii()
(a, b) = ([], [])
for i in range(n):
	(l, m) = fmi()
	a.append(l)
	b.append(m)
count = 2
for i in range(1, n - 1):
	if a[i] - b[i] > a[i - 1]:
		count += 1
	elif b[i] + a[i] < a[i + 1]:
		count += 1
		a[i] = b[i] + a[i]
if n == 1:
	print(1)
else:
	print(count)


n = int(input())
l = []
for i in range(n):
	l.append(list(map(int, input().split())))
count = 2
start = l[0][0]
for i in range(1, n - 1):
	if l[i][0] - l[i][1] > start:
		count += 1
		start = l[i][0]
	elif l[i][0] + l[i][1] < l[i + 1][0]:
		count += 1
		start = l[i][0] + l[i][1]
	else:
		start = l[i][0]
print(min(n, count))


def arr_inp():
	return [int(x) for x in stdin.readline().split()]

def dp():
	mem[0] = 1
	for j in range(1, n):
		mem[j] = mem[j - 1]
		if a[j][0] - a[j][1] > a[j - 1][0]:
			mem[j] += 1
		elif j < n - 1:
			if a[j][0] + a[j][1] < a[j + 1][0]:
				mem[j] += 1
				a[j][0] += a[j][1]
		else:
			mem[j] += 1
	return mem[n - 1]
from collections import defaultdict
from sys import stdin
n = int(input())
(a, mem) = ([arr_inp() for i in range(n)], defaultdict(lambda : -1))
print(dp())


n = int(input())
trees = []
for i in range(n):
	(xi, hi) = 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:
			count += 1
			last = x
		elif x + h < next:
			count += 1
			last = x + h
		else:
			last = x
	print(count)


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


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

def wood(l):
	n = len(l)
	a = float('-inf')
	s = 0
	for i in range(n - 1):
		j = l[i]
		if j[0] - j[1] > a:
			s += 1
			a = j[0]
		elif j[0] + j[1] < l[i + 1][0]:
			s += 1
			a = j[0] + j[1]
		else:
			a = j[0]
	s += 1
	return s
print(wood(l))


n = int(input())
trees = []
for i in range(n):
	trees.append(list(map(int, input().split())))
trees.sort()
if n == 1:
	print(1)
else:
	dp = [[0 for i in range(3)] for j in range(n)]
	dp[0][0] = 1
	dp[0][1] = 1
	for i in range(1, n - 1):
		if trees[i][0] - trees[i][1] > trees[i - 1][0] + trees[i - 1][1]:
			dp[i][0] = max(dp[i - 1]) + 1
		elif trees[i][0] - trees[i][1] > trees[i - 1][0]:
			dp[i][0] = max(dp[i - 1][0], dp[i - 1][2]) + 1
		if trees[i][0] + trees[i][1] < trees[i + 1][0]:
			dp[i][1] = max(dp[i - 1]) + 1
		dp[i][2] = max(dp[i - 1])
	print(max(dp[n - 2]) + 1)


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())
x_l = []
h_l = []
if n == 1:
	print(1)
else:
	for i in range(n):
		(x, h) = map(int, input().split())
		x_l.append(x)
		h_l.append(h)
	ans = 2
	left = x_l[0]
	for i in range(1, n - 1):
		if left < x_l[i] - h_l[i]:
			ans += 1
			left = x_l[i]
		elif x_l[i] + h_l[i] < x_l[i + 1]:
			ans += 1
			left = x_l[i] + h_l[i]
		else:
			left = x_l[i]
	print(ans)


n = int(input())
k = l = co = 0
co = 2
arr = [list(map(int, input().split())) for i in range(n)]
prev = arr[0][0]
for i in range(1, n - 1):
	(l, h) = arr[i]
	if l - h > prev:
		co += 1
		prev = l
	elif l + h < arr[i + 1][0]:
		prev = l + h
		co += 1
	else:
		prev = l
print(co if n > 1 else 1)


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


n = int(input())
a = []
for i in range(n):
	a.append(tuple(map(int, input().split())))
if n > 1:
	ans = 2
	rast = a[1][0] - a[0][0]
	for i in range(1, n - 1):
		if a[i][1] < rast:
			ans += 1
			rast = a[i + 1][0] - a[i][0]
		elif a[i][1] < a[i + 1][0] - a[i][0]:
			ans += 1
			rast = a[i + 1][0] - a[i][0] - a[i][1]
		else:
			rast = a[i + 1][0] - a[i][0]
	print(ans)
else:
	print(1)


n = int(input())
X = []
H = []
for i in range(n):
	(x, h) = [int(i) for i in input().split()]
	X.append(x)
	H.append(h)
ans = 1
last = X[0]
for i in range(1, n - 1):
	if X[i] - H[i] > last:
		ans += 1
		last = X[i]
	elif X[i] + H[i] < X[i + 1]:
		ans += 1
		last = X[i] + H[i]
	else:
		last = X[i]
if n > 1:
	ans += 1
print(ans)


n = int(input())
d = []
for i in range(n):
	d.append(list(map(int, input().split())))
if n == 1:
	print(1)
else:
	c = 2
	mgr = False
	for i in range(1, n - 1):
		if mgr:
			if d[i][0] - d[i][1] > d[i - 1][0] + d[i - 1][1]:
				mgr = False
				c += 1
			elif d[i][0] + d[i][1] < d[i + 1][0]:
				c += 1
			else:
				mgr = False
		elif d[i][0] - d[i][1] > d[i - 1][0]:
			c += 1
		elif d[i][0] + d[i][1] < d[i + 1][0]:
			c += 1
			mgr = True
	print(c)


n = int(input())
tree = []
for i in range(n):
	(x, h) = map(int, input().split())
	tree.append([x, h])
tree.sort(key=lambda x: x[0])
fullroad = tree[0][0]
ans = 1
for j in range(1, n - 1):
	x = tree[j][0]
	h = tree[j][1]
	if x - h > fullroad:
		fullroad = x
		ans += 1
	elif x + h < tree[j + 1][0]:
		fullroad = x + h
		ans += 1
	else:
		fullroad = x
		continue
print(ans + 1 * (n > 1))


from collections import deque
import sys

class Tree:

	def __init__(self, pos, height):
		self.pos = pos
		self.height = height
line = input().split(' ')
test_cases = int(line[0])
trees_lr = deque([])
for tc in range(test_cases):
	line = input().split(' ')
	trees_lr.append(Tree(int(line[0]), int(line[1])))
if len(trees_lr) == 1:
	sys.stdout.write(str(1))
else:
	lb = trees_lr.popleft().pos
	ub = trees_lr.pop().pos
	count = 2
	is_left = True
	while trees_lr:
		if is_left:
			cur_tree = trees_lr.popleft()
			if cur_tree.pos - cur_tree.height > lb:
				count += 1
				lb = cur_tree.pos
			else:
				if trees_lr:
					next_tree = trees_lr.popleft()
					next_pos = next_tree.pos
					trees_lr.appendleft(next_tree)
				else:
					next_pos = ub
				if cur_tree.pos + cur_tree.height < next_pos:
					count += 1
					lb = cur_tree.pos + cur_tree.height
				else:
					lb = cur_tree.pos
			is_left = False
		else:
			cur_tree = trees_lr.pop()
			if cur_tree.pos + cur_tree.height < ub:
				count += 1
				ub = cur_tree.pos
			else:
				if trees_lr:
					next_tree = trees_lr.pop()
					next_pos = next_tree.pos
					trees_lr.append(next_tree)
				else:
					next_pos = lb
				if cur_tree.pos - cur_tree.height > next_pos:
					count += 1
					ub = cur_tree.pos - cur_tree.height
				else:
					ub = cur_tree.pos
			is_left = True
	sys.stdout.write(str(count))


n = int(input())
c = 1
op = int(input().split()[0])
for i in range(n - 1):
	(p, l) = map(int, input().split())
	if op < p:
		c += 1
	else:
		op = op - l0
	if p - l > op:
		op = p
	else:
		op = p + l
		l0 = l
print([c, 1][n == 1])


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


from collections import deque, OrderedDict
n = int(input())
tree_pos = []
tree_len = []
for i in range(n):
	(x, h) = map(int, input().split())
	tree_pos.append(x)
	tree_len.append(h)
if n == 1:
	print(1)
	exit(0)
current = 2
prev = tree_pos[0]
for i in range(1, n - 1):
	if tree_pos[i] - tree_len[i] > prev:
		current += 1
		prev = tree_pos[i]
	elif tree_pos[i] + tree_len[i] < tree_pos[i + 1]:
		current += 1
		prev = tree_pos[i] + tree_len[i]
	else:
		prev = tree_pos[i]
print(current)


n = int(input())
a = []
for i in range(n):
	(k, v) = [int(c) for c in input().split()]
	a.append((k, v))
total = 0
lastOccupied = a[0][0]
for i in range(n):
	if i == 0 or i == n - 1:
		total += 1
	elif a[i][0] - a[i][1] > lastOccupied:
		total += 1
		lastOccupied = a[i][0]
	elif a[i][0] + a[i][1] < a[i + 1][0]:
		total += 1
		lastOccupied = a[i][0] + a[i][1]
	else:
		lastOccupied = a[i][0]
print(total)


import sys
input = sys.stdin.readline
n = int(input())
lis = []
for i in range(n):
	(x, h) = map(int, input().split())
	lis.append((x, h))
if n <= 2:
	print(n)
	exit()
else:
	ans = 2
	last = lis[0][0]
	for i in range(1, n - 1):
		(x, h) = lis[i]
		if x > last + h:
			ans += 1
			last = x
		elif lis[i + 1][0] > x + h:
			ans += 1
			last = x + h
		else:
			last = x
	print(ans)


arr = []
for i in range(int(input())):
	arr.append([int(x) for x in input().split()])
p = arr[0][0]
count = i = 1
while i < len(arr):
	if arr[i][0] - arr[i][1] > p:
		p = arr[i][0]
		count += 1
	elif i < len(arr) - 1 and arr[i][0] + arr[i][1] < arr[i + 1][0]:
		p = arr[i][0] + arr[i][1]
		count += 1
	elif i == len(arr) - 1:
		count += 1
	else:
		p = arr[i][0]
	i += 1
print(count)


n = int(input())
lis = []
for i in range(n):
	(x, h) = map(int, input().split())
	lis.append([x, h])
count = 2
for i in range(1, len(lis) - 1):
	if lis[i][1] < lis[i][0] - lis[i - 1][0]:
		count += 1
	elif lis[i][1] + lis[i][0] < lis[i + 1][0]:
		count += 1
		lis[i][0] = lis[i][1] + lis[i][0]
if n == 1:
	print(1)
elif n == 2:
	print(2)
else:
	print(count)


from sys import stdin, stdout
import bisect
I = lambda : stdin.readline().strip()
read = lambda : map(int, stdin.readline().split())
n = int(I())
arr = [tuple(read()) for i in range(n)]
arr.sort()
last_occupied = -10 ** 9
count = 0
n1 = n - 1
for (ind, i) in enumerate(arr):
	(x, r) = i
	if x - r > last_occupied:
		last_occupied = x
		count += 1
	elif ind == n1 or arr[ind + 1][0] > x + r:
		last_occupied = x + r
		count += 1
	else:
		last_occupied = x
print(count)
quit()
s = I()
min_so_far = track = sum([i.upper() == i for i in s])
for i in s:
	track += [-1, 1][i.lower() == i]
	min_so_far = min(min_so_far, track)
print(min_so_far)
quit()
len_s = len(s)
(tempu, templ) = (0, 0)
(dpu, dpl) = ([0] * (len_s + 1), [0] * (len_s + 1))
for (ind, i) in enumerate(s):
	if i == i.lower():
		tempu += 1
	dpu[ind + 1] = tempu
for i in range(len(s) - 1, -1, -1):
	if s[i] == s[i].upper():
		templ += 1
	dpl[i] = templ
print(min([dpu[x] + dpl[x + 1] for x in range(len_s)]))
quit()
s = I()
x = s.find('AB')
if x > -1:
	if s[x + 2:].find('BA') > -1:
		print('YES')
		quit()
x = s.find('BA')
if x > -1:
	if s[x + 2:].find('AB') > -1:
		print('YES')
		quit()
print('NO')
quit()
n = int(I())
s = tuple(read())
c = tuple(read())
INF = 10 ** 9
min_so_far = INF
for j in range(n):
	m1 = min([INF] + [c[i] for i in range(j) if s[i] < s[j]])
	m2 = min([INF] + [c[i] for i in range(j + 1, n) if s[i] > s[j]])
	min_so_far = min(min_so_far, c[j] + m1 + m2)
print(min_so_far if min_so_far < INF else -1)
quit()
(n, m, d) = read()
arr = []
for i in range(n):
	arr.extend(list(read()))
base = arr[0]
for i in arr:
	if (i - base) % d:
		print(-1)
		quit()
arr.sort()
s = n * m
Sum = 0
dev1 = dev2 = 0
if s % 2:
	median = arr[s // 2]
	for i in arr:
		Sum += abs(i - median)
else:
	(m1, m2) = (arr[s // 2 - 1], arr[s // 2])
	Sum2 = 0
	for i in arr:
		Sum += abs(i - m1)
		Sum2 += abs(i - m2)
	Sum = min(Sum, Sum2)
print(Sum // d)


lastx = -float('inf')
okdone = 0
task = [tuple(map(int, input().split())) for i in range(int(input()))] + [(float('inf'), float('inf'))]
for i in range(len(task) - 1):
	(a, b) = task[i]
	if a - b > lastx:
		lastx = a
		okdone += 1
	elif a + b < task[i + 1][0]:
		lastx = a + b
		okdone += 1
	else:
		lastx = a
print(okdone)


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(c)


n = int(input())
if n == 1:
	print(1)
else:
	pos = []
	heights = []
	for i in range(0, n):
		a = list(map(int, input().split()))
		pos.append(a[0])
		heights.append(a[1])
	count = 2
	for i in range(1, n - 1):
		if pos[i] - heights[i] > pos[i - 1]:
			count = count + 1
		elif pos[i] + heights[i] < pos[i + 1]:
			count = count + 1
			pos[i] = pos[i] + heights[i]
	print(count)


n = int(input())
a = []
for i in range(n):
	(x, h) = [int(x) for x in input().split()]
	a.append((x, h))
sum = 2
y = a[0][0]
for i in range(1, len(a) - 1):
	if a[i - 1][0] < a[i][0] - a[i][1]:
		if y < a[i][0] - a[i][1]:
			y = a[i][0]
			sum += 1
		elif a[i][0] + a[i][1] < a[i + 1][0]:
			sum += 1
			y = a[i][0] + a[i][1]
	elif a[i][0] + a[i][1] < a[i + 1][0]:
		sum += 1
		y = a[i][0] + a[i][1]
	else:
		sum += 0
if n != 1:
	print(sum)
else:
	print(1)


l_t = list()
for _ in range(int(input())):
	l_t.append(list(map(int, input().split())))
t = min(2, len(l_t))
i = 1
p_l = l_t[0][0]
while i < len(l_t) - 1:
	if l_t[i][0] - l_t[i][1] > p_l:
		p_l = l_t[i][0]
		t += 1
	elif l_t[i][0] + l_t[i][1] < l_t[i + 1][0]:
		p_l = l_t[i][0] + l_t[i][1]
		t += 1
	else:
		p_l = l_t[i][0]
	i += 1
print(t)


n = int(input())
x = []
h = []
for i in range(n):
	thepair = input().split()
	x.append(int(thepair[0]))
	h.append(int(thepair[1]))
answer = 2
rightx = -1
for i in range(1, n - 1):
	thex = x[i]
	theh = h[i]
	if rightx > -1:
		prevx = rightx
	else:
		prevx = x[i - 1]
	if thex - theh > prevx:
		answer = answer + 1
		rightx = -1
	elif thex + theh < x[i + 1]:
		answer = answer + 1
		rightx = thex + theh
	else:
		rightx = -1
if n == 1:
	print(1)
else:
	print(answer)


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())
act = []
for i in range(n):
	(x, h) = map(int, input().split())
	act.append([[x - h, x], [x, x + h]])
fall = [act[0][0]]
for i in range(1, len(act) - 1):
	if act[i][0][0] > act[i - 1][0][1]:
		fall.append(act[i][0])
	if act[i][1][1] < act[i + 1][0][1]:
		fall.append(act[i][1])
fall.append(act[-1][1])
fall = sorted(fall, key=lambda x: x[1])
ans = 1
last = fall[0]
for i in fall[1:]:
	if i[0] > last[1]:
		last = i
		ans += 1
print(ans)


import sys
input = sys.stdin.readline

def multi_input():
	return map(int, input().split())

def array_print(arr):
	print(' '.join(map(str, arr)))
n = int(input())
pos = []
heights = []
for i in range(n):
	(p, h) = multi_input()
	pos.append(p)
	heights.append(h)
dp = [[0 for i in range(n)] for j in range(2)]
dp[0][0] = 1
dp[1][0] = 0
for i in range(1, n - 1):
	if dp[1][i - 1] > dp[0][i - 1]:
		if heights[i - 1] + pos[i - 1] < pos[i] - heights[i]:
			dp[0][i] = dp[1][i - 1] + 1
			dp[1][i] = dp[1][i - 1]
		elif pos[i] + heights[i] < pos[i + 1]:
			dp[1][i] = max(dp[0][i - 1], dp[1][i - 1]) + 1
			dp[0][i] = dp[1][i - 1]
		else:
			dp[0][i] = max(dp[0][i - 1], dp[1][i - 1])
			dp[1][i] = max(dp[0][i - 1], dp[1][i - 1])
	elif pos[i - 1] < pos[i] - heights[i]:
		dp[0][i] = dp[0][i - 1] + 1
		dp[1][i] = dp[1][i - 1]
	elif pos[i] + heights[i] < pos[i + 1]:
		dp[1][i] = max(dp[0][i - 1], dp[1][i - 1]) + 1
		dp[0][i] = dp[1][i - 1]
	else:
		dp[0][i] = max(dp[0][i - 1], dp[1][i - 1])
		dp[1][i] = max(dp[0][i - 1], dp[1][i - 1])
if n > 1:
	print(max(dp[0][n - 2], dp[1][n - 2]) + 1)
else:
	print(1)


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)


n = int(input())
(p1, h1) = [int(i) for i in input().split()]
if n == 1:
	print(1)
else:
	(c1, h2) = [int(i) for i in input().split()]
	ans = 1
	for i in range(1, n - 1):
		(n1, h3) = [int(i) for i in input().split()]
		if c1 - p1 > h2:
			ans += 1
		elif n1 - c1 > h2:
			ans += 1
			c1 = c1 + h2
		p1 = c1
		(c1, h2) = (n1, h3)
	print(ans + 1)


ll = lambda : map(int, input().split())
t = lambda : int(input())
ss = lambda : input()
n = t()
(x, h) = ([], [])
for _ in range(n):
	(a, b) = ll()
	x.append(a)
	h.append(b)
if n >= 2:
	c = 2
	tx = x[0]
	for i in range(1, n - 1):
		if x[i] - tx > h[i]:
			tx = x[i]
			c += 1
		elif x[i + 1] - x[i] > h[i]:
			tx = x[i] + h[i]
			c += 1
		else:
			tx = x[i]
	print(c)
else:
	print(1)


n = int(input())
a = [[int(x) for x in input().split()] for i in range(n)]
f = [[0, 0, 0] for i in range(n)]
f[0][0] = f[0][1] = 1
if n == 1:
	print(n)
else:
	for i in range(1, n):
		if a[i - 1][1] + a[i][1] < a[i][0] - a[i - 1][0]:
			f[i][0] = f[i - 1][1] + 1
		if a[i][1] < a[i][0] - a[i - 1][0]:
			f[i][0] = max(f[i][0], f[i - 1][0] + 1, f[i - 1][2] + 1)
		if a[i - 1][1] < a[i][0] - a[i - 1][0]:
			f[i][2] = f[i - 1][1]
		f[i][2] = max(f[i][2], f[i - 1][2], f[i - 1][0])
		if a[i - 1][1] < a[i][0] - a[i - 1][0]:
			f[i][1] = f[i - 1][1] + 1
		f[i][1] = max(f[i][1], f[i - 1][0] + 1, f[i - 1][2] + 1)
	print(max(f[n - 1][0], f[n - 1][1], f[n - 1][2]))


l = []
n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	l.append((a, b))
count = min(n, 2)
left = 1
for i in range(1, n - 1):
	if left:
		if l[i][0] - l[i - 1][0] > l[i][1]:
			count += 1
		elif l[i + 1][0] - l[i][0] > l[i][1]:
			count += 1
			left = 0
			l[i] = (l[i][0] + l[i][1], l[i][1])
	elif l[i][0] - l[i - 1][0] > l[i][1]:
		count += 1
		left = 1
	elif l[i + 1][0] - l[i][0] > l[i][1]:
		count += 1
		l[i] = (l[i][0] + l[i][1], l[i][1])
print(count)


n = int(input())
a = [[int(x) for x in input().split()] for i in range(n)]
if len(a) > 1:
	k = 2
	d_left = a[1][0] - a[0][0]
	l = 0
	for i in range(1, n - 1):
		if l == 0 and a[i][1] < a[i][0] - a[i - 1][0] or (a[i][1] < d_left and l == 1):
			k += 1
			d_left = a[i + 1][0] - a[i][0]
			l = 0
		elif a[i][1] < a[i + 1][0] - a[i][0]:
			k += 1
			d_left = a[i + 1][0] - a[i][0] - a[i][1]
			l = 1
		else:
			l = 0
			d_left = a[i + 1][0] - a[i][0] - a[i][1]
	print(k)
else:
	print(len(a))


n = int(input())
input_c = [0 for i in range(n)]
input_h = [0 for i in range(n)]
for i in range(n):
	values = input().split(' ')
	input_c[i] = int(values[0])
	input_h[i] = int(values[1])
fallen = 2
if n == 1 or n == 0:
	fallen = n
for i in range(1, n - 1):
	left_d = input_c[i] - input_c[i - 1] - 1
	right_d = input_c[i + 1] - input_c[i] - 1
	if left_d >= input_h[i] and left_d > 0:
		fallen += 1
		continue
	if right_d >= input_h[i] and right_d > 0:
		fallen += 1
		input_c[i] += input_h[i]
		continue
print(fallen)


n = int(input())
l = []
for i in range(n):
	l += list(map(int, input().split()))
c = 2
s = l[0]
for i in range(1, n - 1):
	j = 2 * i
	if l[j] - s > l[j + 1]:
		c += 1
		s = l[j]
		continue
	if l[j] + l[j + 1] < l[j + 2]:
		c += 1
		s = l[j] + l[j + 1]
		continue
	s = l[j]
print(n if n < 2 else c)


l = []
for i in range(int(input())):
	l.append(list(map(int, input().split())))
z = []
d = 0
for i in range(len(l) - 1):
	z.append(abs(l[i][0] - l[i + 1][0]))
	if i > 0:
		if l[i][1] < z[i - 1]:
			d += 1
			z[i - 1] = abs(l[i][1] - z[i - 1])
		elif l[i][1] < z[i]:
			d += 1
			z[i] = abs(l[i][1] - z[i])
if len(l) > 2:
	print(d + 2)
else:
	print(len(l))


n = int(input())
trees = []
for t in range(n):
	trees.append(list(map(int, input().split())))
if n < 2:
	print(n)
else:
	min = trees[0][0]
	cut = 2
	for i in range(1, n - 1):
		t = trees[i]
		x = t[0]
		h = t[1]
		max = trees[i + 1][0]
		cut_left = (x - h, x)
		cut_right = (x, x + h)
		if cut_left[0] > min:
			cut += 1
			min = cut_left[1]
		elif cut_right[1] < max:
			cut += 1
			min = cut_right[1]
		else:
			min = x
	print(cut)


n = int(input())
trees = [[int(x) for x in input().split()] for i in range(n)]
location = [trees[i][0] for i in range(n)]
height = [trees[i][1] for i in range(n)]
if n == 1:
	print(1)
	exit()
down = 2
for i in range(1, n - 1):
	if location[i] - height[i] > location[i - 1]:
		down += 1
	elif location[i] + height[i] < location[i + 1]:
		down += 1
		location[i] = location[i] + height[i]
print(down)


n = int(input())
tree = []
for i in range(n):
	tree.append(list(map(int, input().split())))
if n <= 2:
	t = n
else:
	t = 2
	for i in range(1, n - 1):
		if tree[i][0] - tree[i - 1][0] > tree[i][1]:
			t += 1
		elif tree[i + 1][0] - tree[i][0] > tree[i][1]:
			t += 1
			tree[i][0] += tree[i][1]
print(t)


n = int(input())
(x, h) = ([], [])
for i in range(n):
	(a, b) = map(int, input().split())
	x.append(a)
	h.append(b)
l = x[0] + 1
count = 1
for j in range(1, n - 1):
	if x[j] - l >= h[j]:
		count += 1
		l = x[j] + 1
	elif x[j + 1] - x[j] > h[j]:
		count += 1
		l = x[j] + h[j] + 1
	else:
		l = x[j] + 1
if n == 1:
	count -= 1
print(count + 1)


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


n = int(input())
x = []
h = []
num = 2
for i in range(n):
	(a, b) = map(int, input().split())
	x.append(a)
	h.append(b)
near = x[0]
if n == 1:
	print(1)
else:
	for i in range(1, n - 1):
		if x[i] - near > h[i]:
			num += 1
			near = x[i]
			continue
		if x[i + 1] - x[i] > h[i]:
			num += 1
			near = x[i] + h[i]
			continue
		near = x[i]
	print(num)


n = int(input())
X = []
H = []
for _ in range(n):
	[x, h] = [int(x) for x in input().split(' ')]
	X.append(x)
	H.append(h)
fell = 1
lastRight = X[0]
for i in range(1, n):
	if i == n - 1:
		fell += 1
	elif lastRight < X[i] - H[i]:
		lastRight = X[i]
		fell += 1
	elif X[i + 1] > X[i] + H[i]:
		lastRight = X[i] + H[i]
		fell += 1
	else:
		lastRight = X[i]
print(fell)


n = int(input())
co = []
hi = []
for i in range(n):
	arr = [int(x) for x in input().split()]
	co.append(arr[0])
	hi.append(arr[-1])
if n <= 2:
	count = n
else:
	count = 2
	for i in range(1, n - 1):
		if hi[i] < co[i] - co[i - 1]:
			count += 1
		elif hi[i] < co[i + 1] - co[i]:
			count += 1
			co[i] += hi[i]
		else:
			continue
print(count)


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())
lst1 = []
lst2 = []
lst = []
if n == 1:
	(a, b) = input().split()
	print(1)
else:
	for i in range(n):
		(a, b) = input().split()
		lst1.append(int(a))
		lst2.append(int(b))
	for j in range(1, n):
		lst.append(lst1[j] - lst1[j - 1])
	p = 2
	u = 0
	for r in range(n):
		if r == 0 or r == n - 1:
			pass
		elif lst[r - 1] > lst2[r] + u:
			p += 1
			u = 0
		elif lst[r] > lst2[r]:
			p += 1
			u = lst2[r]
		else:
			u = 0
	print(p)


import os
import sys
from io import BytesIO, IOBase

def solution(trees, heights, n):
	if n == 1:
		write(1)
		return
	dp = [[0] * 3 for _ in range(n)]
	trees.append(float('inf'))
	dp[0][0] = 0
	dp[0][1] = 1
	dp[0][2] = 1 if trees[0] + heights[0] < trees[1] else 0
	for i in range(1, n):
		if trees[i - 1] + heights[i - 1] >= trees[i]:
			dp[i][0] = max(dp[i - 1][0], dp[i - 1][1])
		else:
			dp[i][0] = max([dp[i - 1][0], dp[i - 1][1], dp[i - 1][2]])
		if trees[i] - heights[i] > trees[i - 1]:
			dp[i][1] = max(dp[i - 1][0], dp[i - 1][1]) + 1
			if trees[i - 1] + heights[i - 1] < trees[i] - heights[i]:
				dp[i][1] = max(dp[i][1], dp[i - 1][2] + 1)
		if trees[i] + heights[i] < trees[i + 1]:
			dp[i][2] = max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2]) + 1
	write(max(dp[-1]))

def main():
	n = r_int()
	N = int(100000.0 + 1)
	(trees, heights) = ([], [])
	for _ in range(n):
		(x, h) = r_array()
		trees.append(x)
		heights.append(h)
	solution(trees, heights, n)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args[:-1]:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(str(args[-1]))
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


n = int(input())
arr = []
for i in range(n):
	pair = list(map(int, input().split()))
	arr.append(pair)
if n == 1:
	print(1)
else:
	dp = [[0, 0, 0] for i in range(n)]
	dp[0][1] = 1
	if arr[0][0] + arr[0][1] < arr[1][0]:
		dp[0][2] = 1
	for i in range(1, n - 1):
		if arr[i][0] - arr[i][1] > arr[i - 1][0] + arr[i - 1][1]:
			dp[i][1] = max(dp[i - 1]) + 1
		elif arr[i][0] - arr[i][1] > arr[i - 1][0]:
			dp[i][1] = max(dp[i - 1][0], dp[i - 1][1]) + 1
		if arr[i][0] + arr[i][1] < arr[i + 1][0]:
			dp[i][2] = max(dp[i - 1]) + 1
		dp[i][0] = max(dp[i - 1])
	print(max(dp[n - 2]) + 1)


n = int(input())
l = []
for i in range(n):
	data = list(map(int, input().split()))
	l.append(data)
ans = 0
occupied = -float('inf')
for i in range(n):
	xl = l[i][0] - l[i][1]
	xr = l[i][0] + l[i][1]
	if xl > occupied:
		ans += 1
		occupied = l[i][0]
	elif i == n - 1:
		ans += 1
	elif xr < l[i + 1][0]:
		ans += 1
		occupied = xr
	else:
		occupied = l[i][0]
print(ans)


n = int(input())
if n == 1:
	print(1)
else:
	xh_pair = []
	for i in range(n):
		xh_pair.append([int(x) for x in input().split()])
	nCount = 1
	i = 1
	while i <= n - 2:
		if xh_pair[i][0] - xh_pair[i][1] > xh_pair[i - 1][0]:
			xh_pair[i][0] = xh_pair[i][0]
			nCount += 1
		elif xh_pair[i][0] + xh_pair[i][1] < xh_pair[i + 1][0]:
			xh_pair[i][0] += xh_pair[i][1]
			nCount += 1
		else:
			pass
		i += 1
	nCount += 1
	print(nCount)


def cut_trees(trees):
	left_boundary = -1
	trees_cut = 0
	for i in range(len(trees)):
		(cx, ch) = trees[i]
		if i == 0:
			left_boundary = cx
			trees_cut += 1
		elif i == len(trees) - 1:
			trees_cut += 1
		else:
			(nx, _) = trees[i + 1]
			cut_left = cx - ch > left_boundary
			cut_right = cx + ch < nx
			if cut_left:
				left_boundary = cx
				trees_cut += 1
			elif cut_right:
				left_boundary = cx + ch
				trees_cut += 1
			else:
				left_boundary = cx
	return trees_cut

def run_alg():
	num_trees = int(input())
	trees = []
	for _ in range(num_trees):
		line_data = input().split(' ')
		tree = (int(line_data[0]), int(line_data[1]))
		trees.append(tree)
	print(cut_trees(trees))
run_alg()


n = int(input())
if n > 2:
	a = 2
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	for i in range(n - 2):
		C = list(map(int, input().split()))
		if B[0] - A[0] > B[1]:
			a += 1
		elif C[0] - B[0] > B[1]:
			a += 1
			B[0] = B[0] + B[1]
		(A, B) = (B, C)
	print(a)
else:
	print(n)


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


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


n = int(input())
if n == 1:
	print(1)
else:
	derrubadas = 2
	arvores = []
	for i in range(n):
		(x, altura) = [int(x) for x in input().split()]
		arvores.append((x, altura))
	p1 = arvores[0][0]
	for i in range(1, n - 1):
		atual = arvores[i]
		if atual[0] - atual[1] > p1:
			derrubadas += 1
			p1 = atual[0]
		else:
			proximo = arvores[i + 1]
			if atual[0] + atual[1] < proximo[0]:
				derrubadas += 1
				p1 = atual[0] + atual[1]
			else:
				p1 = atual[0]
	print(derrubadas)


n = int(input())
(x1, h1) = map(int, input().split())
ans = 1
prev = 1
for i in range(1, n):
	(x2, h2) = map(int, input().split())
	if not prev:
		if x1 + h1 < x2:
			ans += 1
			x1 += h1
	if x2 - h2 > x1:
		ans += 1
		prev = 1
	else:
		prev = 0
	(x1, h1) = (x2, h2)
if not prev:
	ans += 1
print(ans)


n = int(input())
x = []
h = []
for i in range(n):
	(a, b) = map(int, input().split())
	x.append(a)
	h.append(b)
c = 1
if n >= 2:
	c = 2
for i in range(1, n - 1):
	l = x[i] - x[i - 1] - 1
	r = x[i + 1] - x[i] - 1
	if h[i] <= l:
		c = c + 1
	elif h[i] <= r:
		c = c + 1
		x[i] = x[i] + h[i]
print(c)


n = int(input())
xs = [0] * n
hs = [0] * n
for i in range(n):
	(x, h) = map(int, input().split())
	xs[i] = x
	hs[i] = h
pos = -float('inf')
xs.append(float('inf'))
count = 0
for i in range(n):
	x = xs[i]
	x1 = xs[i + 1]
	h = hs[i]
	if x - h > pos:
		count += 1
		pos = x
	elif x + h < x1:
		count += 1
		pos = x + h
	else:
		pos = x
print(count)


import sys

def answer(n, x, h):
	if n <= 2:
		return n
	cuttrees = 2
	L = x[0]
	for i in range(1, n - 1):
		if x[i] - h[i] > L:
			L = x[i]
			cuttrees += 1
		elif x[i] + h[i] < x[i + 1]:
			L = x[i] + h[i]
			cuttrees += 1
		else:
			L = x[i]
	return cuttrees

def main():
	n = int(sys.stdin.readline())
	x = [0 for i in range(n)]
	h = [0 for i in range(n)]
	for i in range(n):
		(x[i], h[i]) = map(int, sys.stdin.readline().split())
	print(answer(n, x, h))
	return
main()


from sys import stdin
from functools import reduce
DEBUG = False

def debug(*args):
	global DEBUG
	if DEBUG == True:
		print(*args)

def solve(p, segs):
	(left, ans) = p
	((_, h), (right, _)) = segs
	if h <= left:
		debug('left')
		return (right, ans + 1)
	if h <= right:
		debug('right')
		return (right - h, ans + 1)
	debug('remain')
	return (right, ans)
n = int(input())
trees = sorted([tuple(map(int, line.split())) for line in stdin.readlines()], key=lambda p: p[0])
if n <= 2:
	print(n)
else:
	segments = list(map(lambda p: (p[1][0] - p[0][0] - 1, p[1][1]), zip(trees, trees[1:])))
	(_, ans) = reduce(solve, zip(segments, segments[1:]), (segments[0][0], 2))
	print(ans)


n = int(input())
coor = []
h = []
line = []
ans = 2
l = 0
r = 0
if n > 2:
	for i in range(n):
		k = input().split()
		line.append([int(k[0]), int(k[1])])
	for i in range(1, n - 1):
		if line[i][0] - line[i][1] > line[i - 1][0] + r:
			ans += 1
			r = 0
		elif line[i][0] + line[i][1] < line[i + 1][0]:
			ans += 1
			r = line[i][1]
		else:
			r = 0
	print(ans)
else:
	print(n)


n = int(input())
if n <= 2:
	print(n)
	exit()
(px, ph) = map(int, input().split())
(x, h) = map(int, input().split())
res = 1
ch = 0
for i in range(1, n - 1):
	(nx, nh) = map(int, input().split())
	if ch + h < x - px:
		res += 1
		ch = 0
	elif h < nx - x:
		res += 1
		ch = h
	else:
		ch = 0
	(px, ph) = (x, h)
	(x, h) = (nx, nh)
res += 1
print(res)


import os, sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import ceil
mod = 10 ** 9 + 7
for _ in range(1):
	n = int(input())
	positions = [0 for i in range(n * 2 - 1)]
	heights = [0 for i in range(n)]
	i = 0
	for i in range(n):
		(p, h) = map(int, input().split())
		positions[i * 2] = p
		if i != 0:
			positions[i * 2 - 1] = positions[i * 2] - positions[i * 2 - 2] - 1
		heights[i] = h
	max_trees_fell = 0
	till = n * 2 - 1
	for i in range(0, till, 2):
		if i in [0, till - 1]:
			max_trees_fell += 1
		elif positions[i - 1] >= heights[i // 2]:
			positions[i - 1] = positions[i - 1] - heights[i // 2]
			max_trees_fell += 1
		elif positions[i + 1] >= heights[i // 2]:
			positions[i + 1] = positions[i + 1] - heights[i // 2]
			max_trees_fell += 1
		else:
			continue
	print(max_trees_fell)


number = int(input())
l = [list(map(int, input().split())) for i in range(number)]
lp = [i[0] for i in l]
lh = [i[1] for i in l]
l2 = [10 ** 9 + 1] + [lp[i + 1] - lp[i] for i in range(number - 1)] + [10 ** 9 + 1]
ans = 0
hb = l2[0]
for i in range(len(lh)):
	ha = l2[i + 1]
	h = lh[i]
	if h < hb:
		ans += 1
		hb = ha
		continue
	if h < ha:
		ans += 1
		hb = ha - h
		continue
	else:
		hb = ha
print(ans)


n = int(input())
trees = [[int(i) for i in input().split()] for j in range(n)]
k = 1
i = 1
j = trees[0][0]
while i < n - 1:
	if trees[i][1] < trees[i][0] - j:
		k += 1
		j = trees[i][0]
		i += 1
	elif trees[i][1] < trees[i + 1][0] - trees[i][0]:
		k += 1
		j = trees[i][0] + trees[i][1]
		i += 1
	else:
		j = trees[i][0]
		i += 1
if n > 1:
	k += 1
print(k)


n = int(input())
pos = []
h = []
for i in range(n):
	(position, height) = map(int, input().split())
	pos.append(position)
	h.append(height)
dp = [[0] * n for i in range(3)]
dp[0][0] = 1
if n >= 2:
	dp[1][0] = 1 if pos[0] + h[0] < pos[1] else 0
for i in range(1, n):
	dp[2][i] = max(dp[2][i - 1], dp[1][i - 1], dp[0][i - 1])
	dp[0][i] = dp[0][i - 1]
	if pos[i] - h[i] > pos[i - 1]:
		dp[0][i] = 1 + max(dp[2][i - 1], dp[0][i - 1])
	if pos[i] - h[i] > pos[i - 1] + h[i - 1]:
		dp[0][i] = max(dp[0][i], dp[1][i - 1] + 1)
	if i < n - 1 and pos[i] + h[i] >= pos[i + 1]:
		continue
	dp[1][i] = 1 + max(dp[0][i - 1], dp[1][i - 1], dp[2][i - 1])
print(max(dp[0][n - 1], dp[1][n - 1], dp[2][n - 1]))


n = int(input())
a = []
for i in range(n):
	c = list(map(int, input().split()))
	a.append(c)
l = min(2, n)
for i in range(1, n - 1):
	if a[i - 1][0] < a[i][0] - a[i][1]:
		l += 1
	elif a[i][0] + a[i][1] < a[i + 1][0]:
		a[i][0] += a[i][1]
		l += 1
print(l)


n = int(input())
data = [[0, 0]] * n
for i in range(n):
	data[i] = [int(d) for d in input().split()]
if n > 1:
	count = 2
else:
	count = 1
left_barrier = data[0][0]
for i in range(1, n - 1):
	if data[i][0] - data[i][1] > left_barrier:
		count += 1
		left_barrier = data[i][0]
	elif data[i][0] + data[i][1] < data[i + 1][0]:
		count += 1
		left_barrier = data[i][0] + data[i][1]
	else:
		left_barrier = data[i][0]
print(count)


import sys
import math
import operator as op
from functools import reduce

def read_line():
	return sys.stdin.readline()[:-1]

def read_int():
	return int(sys.stdin.readline())

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]

def read_float_line():
	return [float(v) for v in sys.stdin.readline().split()]

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer / denom
t = 1
for i in range(t):
	n = read_int()
	l = []
	for i in range(n):
		(x, h) = read_int_line()
		l.append([x, h])
	dp = [[0, 0] for i in range(n)]
	dp[0][0] = 1
	if n == 1:
		print(1)
	else:
		if l[0][0] + l[0][1] < l[1][0]:
			dp[0][1] = 1
		for i in range(1, n):
			if l[i][0] - l[i][1] > l[i - 1][0]:
				dp[i][0] = 1 + dp[i - 1][0]
			else:
				dp[i][0] = dp[i - 1][0]
			if l[i][0] - l[i][1] > l[i - 1][0] + l[i - 1][1]:
				dp[i][0] = max(dp[i][0], 1 + dp[i - 1][1])
			else:
				dp[i][0] = max(dp[i][0], dp[i - 1][1])
			v = max(dp[i - 1][0], dp[i - 1][1])
			if i != n - 1 and l[i][0] + l[i][1] < l[i + 1][0]:
				dp[i][1] = 1 + v
			elif i == n - 1:
				dp[i][1] = 1 + v
			else:
				dp[i][1] = v
		m = -1
		for i in range(n):
			v = max(dp[i - 1][0], dp[i - 1][1])
			m = max(m, v)
		ans = m
		print(ans)


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


from os import path
import sys, time, collections as c, math as m, pprint as p
(maxx, localsys, mod) = (float('inf'), 0, int(1000000000.0 + 7))
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
input = sys.stdin.readline
a = [[int(x) for x in input().split()] for _ in range(int(input()))]
n = len(a)
ans = 2
if n < 2:
	(print(1), exit())
for i in range(1, n - 1):
	if a[i][0] - a[i][1] > a[i - 1][0]:
		ans += 1
	elif a[i][0] + a[i][1] < a[i + 1][0]:
		ans += 1
		a[i][0] += a[i][1]
print(ans)


def main():
	n = int(input())
	trees = []
	for i in range(n):
		(x, h) = map(int, input().split())
		trees.append([x, h])
	max_trees = min(2, n)
	for i in range(1, n - 1):
		(x, h) = (trees[i][0], trees[i][1])
		if x - h > trees[i - 1][0]:
			max_trees += 1
		elif x + h < trees[i + 1][0]:
			max_trees += 1
			trees[i][0] += h
	print(max_trees)
main()


n = int(input())
X = []
H = []
for i in range(n):
	(x, h) = map(int, input().split())
	X.append(x)
	H.append(h)
if n > 1:
	r = 2
else:
	r = 1
for i in range(1, n - 1):
	if X[i] - X[i - 1] > H[i]:
		r += 1
	elif X[i + 1] - X[i] > H[i]:
		r += 1
		X[i] = X[i] + H[i]
print(r)


from sys import stdin
N = int(stdin.readline())
(X, H) = tuple(map(list, tuple(zip(*tuple((tuple(map(int, stdin.readline().strip().split())) for n in range(N)))))))
H[0] = 0
H[-1] = 0
for i in range(1, len(X) - 1):
	if H[i] < X[i] - X[i - 1]:
		H[i] = 0
	elif H[i] < X[i + 1] - X[i]:
		X[i] += H[i]
		H[i] = 0
print(sum((k == 0 for k in H)))


n = int(input())
a = [tuple((int(x) for x in input().split())) for _ in range(n)]
s = 0
r = False
for i in range(n):
	if i == 0 or a[i][0] - a[i][1] > a[i - 1][0] + (a[i - 1][1] if r else 0):
		s += 1
		r = False
	elif i == n - 1 or a[i][0] + a[i][1] < a[i + 1][0]:
		s += 1
		r = True
	else:
		r = False
print(s)


from sys import stdin, stdout

def main():
	n = int(stdin.readline())
	x = [0] * (n + 1)
	h = [0] * (n + 1)
	for i in range(1, n + 1):
		(xi, hi) = map(int, stdin.readline().split())
		x[i] = xi
		h[i] = hi
	r = [0] * (n + 1)
	l = [0] * (n + 1)
	p = [0] * (n + 1)
	for i in range(1, n + 1):
		p[i] = max(r[i - 1], l[i - 1], p[i - 1])
		l[i] = -1
		if i == 1:
			l[i] = 1
		else:
			if x[i - 1] < x[i] - h[i]:
				l[i] = max(l[i - 1], p[i - 1]) + 1
			if x[i - 1] + h[i - 1] < x[i] - h[i]:
				l[i] = max(l[i], r[i - 1] + 1)
		r[i] = -1
		if i == n:
			r[i] = max(r[i - 1], l[i - 1], p[i - 1]) + 1
		elif x[i] + h[i] < x[i + 1]:
			r[i] = max(r[i - 1], l[i - 1], p[i - 1]) + 1
	print(max(r[i], l[i], p[i]))
main()


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


n = int(input())
num = [[int(x) for x in input().split()] for i in range(n)]
outcome = 0
if n == 1:
	print(1)
else:
	for i in range(1, n - 1):
		if num[i][1] < num[i][0] - num[i - 1][0]:
			outcome += 1
		elif num[i + 1][0] - num[i][0] > num[i][1]:
			outcome += 1
			num[i][0] += num[i][1]
	print(outcome + 2)


n = int(input())
x = [0] * n
h = [0] * n
for i in range(n):
	(x[i], h[i]) = [int(k) for k in input().split()]
l = [-1] * n
r = [-1] * n

def f():
	count = 0
	left = x[0]
	i = 0
	while True:
		if n == 1:
			count = 1
			break
		if i == 0:
			count = 1
			left = x[0]
		elif i == n - 1:
			count += 1
			break
		elif h[i] < x[i] - left:
			count += 1
			left = x[i]
		elif h[i] < x[i + 1] - x[i]:
			count += 1
			left = x[i] + h[i]
		else:
			left = x[i]
		i += 1
	print(count)
	return count
f()


n = int(input())
l = []
for i in range(n):
	(x, h) = map(int, input().split())
	l.append([x, h])
ans = 1
maxx = 1
left = 0
if n > 1:
	left = l[1][0] - l[0][0]
	for i in range(1, n - 1):
		right = l[i + 1][0] - l[i][0]
		if l[i][1] < left:
			maxx += 1
			i += 1
			left = l[i][0] - l[i - 1][0]
		elif l[i][1] < right:
			maxx += 1
			i += 1
			left = l[i][0] - l[i - 1][0] - l[i - 1][1]
		else:
			i += 1
			left = l[i][0] - l[i - 1][0]
	print(maxx + 1)
else:
	print(1)


n = int(input())
data = [[int(x) for x in input().split()] for i in range(n)] + [[0, 0]]
if n > 2:
	i = 2
	left = data[1][0] - data[0][0]
	right = data[2][0] - data[1][0]
	for j in range(1, n - 1):
		if left > data[j][1]:
			i += 1
			left = right
		elif right > data[j][1]:
			i += 1
			left = right - data[j][1]
		else:
			left = right
		right = data[j + 2][0] - data[j + 1][0]
	print(i)
elif n == 2:
	print(2)
else:
	print(1)


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)


import sys
import bisect
from collections import deque
RI = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
n = int(ri())
pos = [-1] * n
a = [-1] * n
for i in range(n):
	(l, b) = RI()
	pos[i] = l
	a[i] = b
if n == 1:
	print(1)
	exit()
cnt = 2
cur = pos[0]
for i in range(1, n - 1):
	if pos[i] - a[i] > cur:
		cnt += 1
		cur = pos[i]
	elif pos[i] + a[i] < pos[i + 1]:
		cnt += 1
		cur = pos[i] + a[i]
	else:
		cur = pos[i]
print(cnt)


import sys
sys.setrecursionlimit(10 ** 5 + 1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]
lens = RI()
arrs = [RMI() for _ in range(lens)]
can_fell = 2
for i in range(1, lens - 1):
	if arrs[i][0] - arrs[i - 1][0] > arrs[i][1]:
		can_fell += 1
	elif arrs[i + 1][0] - arrs[i][0] > arrs[i][1]:
		arrs[i][0] += arrs[i][1]
		can_fell += 1
print(1 if len(arrs) == 1 else can_fell)


n = int(input())
pair = []
for i in range(n):
	(x, h) = map(int, input().split())
	pair.append((x, h))
count = 1
pre = pair[0][0]
for i in range(1, n - 1):
	c = pair[i]
	nt = pair[i + 1]
	if c[0] - pre > c[1]:
		count += 1
		pre = c[0]
	elif nt[0] - c[0] > c[1]:
		count += 1
		pre = c[0] + c[1]
		continue
	pre = c[0]
if n == 1:
	print(1)
else:
	print(count + 1)


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def debug(*var, sep=' ', end='\n'):
	print(*var, file=sys.stderr, end=end, sep=sep)
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
(n,) = I()
a = [[INF, INF]]
for i in range(n):
	(x, h) = I()
	a.append([x, h])
a.sort()
ans = 1
for i in range(1, n):
	if a[i][0] - a[i - 1][0] > a[i][1]:
		ans += 1
	elif a[i + 1][0] - a[i][0] > a[i][1]:
		ans += 1
		a[i][0] += a[i][1]
print(ans)


from collections import Counter
import string
import math
import sys

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))

def printDivisors(n):
	divisors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				divisors.append(i)
			else:
				divisors.extend((i, n // i))
		i = i + 1
	return divisors
n = vary(1)
trees = []
for i in range(n):
	(u, v) = vary(2)
	trees.append([u, v])
count = 1
if n == 1:
	print(count)
	exit()
trees.sort()
for i in range(n - 2):
	if trees[i + 1][0] - trees[i + 1][1] > trees[i][0]:
		count += 1
	elif trees[i + 1][0] + trees[i + 1][1] < trees[i + 2][0]:
		count += 1
		trees[i + 1][0] = trees[i + 1][0] + trees[i + 1][1]
print(count + 1)


def answer(n, A):
	if n <= 2:
		return n
	count = 2
	r = A[0][0]
	for i in range(1, n - 1):
		if A[i][0] - A[i][1] > r:
			count += 1
			r = A[i][0]
		elif A[i][0] + A[i][1] < A[i + 1][0]:
			count += 1
			r = A[i][0] + A[i][1]
		else:
			r = A[i][0]
	return count
n = int(input())
A = []
for i in range(n):
	(x, h) = map(int, input().split())
	A.append([x, h])
print(answer(n, A))


n = int(input())
(x, h) = ([], [])
for i in range(n):
	(xv, hv) = map(int, input().split())
	x.append(xv)
	h.append(hv)
dp = [[0] * n for _ in range(3)]
dp[0][0] = 0
dp[1][0] = 1
if len(x) > 1 and x[0] + h[0] < x[1]:
	dp[2][0] = 1
else:
	dp[2][0] = 0
for i in range(1, n):
	prev_max = max(max(dp[0][i - 1], dp[1][i - 1]), dp[2][i - 1])
	dp[0][i] = prev_max
	if x[i - 1] < x[i] - h[i]:
		dp[1][i] = max(dp[0][i - 1], dp[1][i - 1]) + 1
		if x[i - 1] + h[i - 1] < x[i] - h[i]:
			dp[1][i] = max(dp[1][i], dp[2][i - 1] + 1)
	else:
		dp[1][i] = prev_max
	dp[2][i] = prev_max
	if i + 1 < n and x[i] + h[i] < x[i + 1]:
		dp[2][i] += 1
	elif i == n - 1:
		dp[2][i] += 1
print(max(max(dp[0][n - 1], dp[1][n - 1]), dp[2][n - 1]))


from sys import stdin
N = int(stdin.readline().rstrip())
trees = [None for n in range(N)]
for n in range(N):
	trees[n] = [int(x) for x in stdin.readline().rstrip().split()]
start = -1000000000
count = 1
for n in range(N - 1):
	tree = trees[n]
	if tree[0] - tree[1] > start:
		count += 1
		start = tree[0]
	elif tree[0] + tree[1] < trees[n + 1][0]:
		count += 1
		start = tree[0] + tree[1]
	else:
		start = tree[0]
print(count)


n = int(input())
arr = [[int(i) for i in input().split(' ')] for j in range(n)]
count = 2 if n >= 2 else 1
for i in range(1, n - 1):
	if arr[i][1] < arr[i][0] - arr[i - 1][0]:
		count += 1
	elif arr[i][1] < arr[i + 1][0] - arr[i][0]:
		count += 1
		arr[i][0] += arr[i][1]
print(count)


n = int(input())
if n == 1:
	print('1')
else:
	o = 2
	q = []
	w = []
	for i in range(n):
		(x, h) = [int(m) for m in input().split()]
		q.append(x)
		w.append(h)
	for i in range(1, n - 1):
		if q[i - 1] < q[i] - w[i]:
			o += 1
		elif q[i - 1] >= q[i] - w[i] and q[i] + w[i] < q[i + 1]:
			o += 1
			d = q[i] + w[i]
			q.pop(i)
			q.insert(i, d)
		else:
			o = o
	print(o)


n = int(input())
f = []
answer = min(2, n)
for i in range(n):
	(x, h) = map(int, input().split())
	f.append([x, h])
p = f[0][0]
for i in range(1, n - 1):
	a = f[i]
	if a[0] - a[1] > p:
		answer += 1
		p = a[0]
	elif a[0] + a[1] < f[i + 1][0]:
		answer += 1
		p = a[0] + a[1]
	else:
		p = a[0]
print(answer)


n = int(input())
line = list()
for i in range(n):
	line.append(list(map(int, input().split())))
if n < 3:
	print(n)
else:
	res = 2
	for i in range(1, n - 1):
		if line[i][1] < line[i][0] - line[i - 1][0]:
			res += 1
		elif line[i][1] < line[i + 1][0] - line[i][0]:
			res += 1
			line[i][0] += line[i][1]
	print(res)


n = int(input())
l = []
for i in range(n):
	l.append(list(map(int, input().split())))
if n < 3:
	print(n)
else:
	count = 2
	for j in range(1, n - 1):
		if l[j][0] - l[j][1] > l[j - 1][0]:
			count += 1
		elif l[j][0] + l[j][1] < l[j + 1][0]:
			count += 1
			l[j][0] = l[j][0] + l[j][1]
		else:
			continue
	print(count)


n = int(input())
x = []
h = []
f = []
for i in range(0, n):
	f.append([0, 0, 0])
for i in range(0, n):
	(a, b) = map(int, input().split())
	x.append(a)
	h.append(b)
f[0][0] = 0
f[0][1] = f[0][2] = 1
for i in range(1, n):
	f[i][0] = max(f[i - 1][0], f[i - 1][1])
	f[i][2] = max(f[i - 1][0], f[i - 1][1]) + 1
	if x[i - 1] + h[i - 1] < x[i]:
		f[i][0] = max(f[i][0], f[i - 1][2])
		f[i][2] = max(f[i][2], f[i - 1][2] + 1)
	if x[i] - h[i] > x[i - 1]:
		f[i][1] = max(f[i - 1][0], f[i - 1][1]) + 1
	if x[i] - h[i] > x[i - 1] + h[i - 1]:
		f[i][1] = max(f[i - 1][2] + 1, f[i][1])
print(max(max(f[n - 1][0], f[n - 1][1]), f[n - 1][2]))


import math

def main():
	n = int(input())
	heights = [(-math.inf, 0)]
	for _ in range(n):
		(x, h) = map(int, input().split())
		heights.append((x, h))
	heights.append((math.inf, 0))
	dp = [[0, 0, 0] for _ in range(n + 1)]
	for i in range(1, n + 1):
		(x, h) = heights[i]
		(x_prev, h_prev) = heights[i - 1]
		(x_next, h_next) = heights[i + 1]
		if x - h > x_prev:
			if x - h > x_prev + h_prev:
				dp[i][1] = max(dp[i - 1]) + 1
			else:
				dp[i][1] = max(dp[i - 1][1], dp[i - 1][0]) + 1
		if x + h < x_next:
			dp[i][2] = max(dp[i - 1]) + 1
		dp[i][0] = max(dp[i - 1])
	print(max(dp[n]))
main()


n = int(input())
coor = []
hight = []
for i in range(n):
	(x, h) = map(int, input().split())
	coor.append(x)
	hight.append(h)
if n <= 2:
	res = n
else:
	res = 2
for i in range(1, n - 1):
	if coor[i] - hight[i] > coor[i - 1]:
		res += 1
	elif coor[i] + hight[i] < coor[i + 1]:
		res += 1
		coor[i] += hight[i]
print(res)


n = int(input())
a = []
for _ in range(n):
	(x, h) = map(int, input().split())
	a.append([x, h])
a.sort(key=lambda x: x[0])
ans = 0
left = -10000000000.0
a.append([10000000000.0, 0])
for i in range(n):
	if a[i][0] - a[i][1] > left:
		ans += 1
		left = a[i][0]
	elif a[i][0] + a[i][1] < a[i + 1][0]:
		ans += 1
		left = a[i][0] + a[i][1]
	else:
		left = a[i][0]
print(ans)


n = int(input())
if n == 1:
	print(1)
else:
	a = []
	b = []
	num = 2
	for i in range(n):
		(p, q) = [int(x) for x in input().split()]
		a.append(p)
		b.append(q)
	for i in range(1, n - 1):
		if a[i] - a[i - 1] > b[i]:
			num += 1
		elif a[i + 1] - a[i] > b[i]:
			a[i] += b[i]
			num += 1
	print(num)


n = int(input())
p = []
for _ in range(n):
	(x, h) = map(int, input().split())
	p.append((x, h))
r = 0
l = -10 ** 12
for i in range(len(p) - 1):
	left = p[i][0] - p[i][1]
	right = p[i][0] + p[i][1]
	if left > l:
		l = p[i][0]
		r += 1
	elif right < p[i + 1][0]:
		l = right
		r += 1
	else:
		l = p[i][0]
print(r + 1)


n = int(input())
trees = []
for i in range(n):
	tree = [int(n) for n in input().split()]
	trees.append(tree)
left = trees[0][0]
cutted = 1
for (i, (x, h)) in enumerate(trees[1:-1]):
	if x - left > h:
		cutted += 1
		left = x
	elif trees[i + 2][0] - x > h:
		cutted += 1
		left = x + h
	else:
		left = x
print(cutted + 1) if len(trees) > 1 else print(cutted)


n = int(input())
t = []
d = []
for i in range(n):
	s = [int(x) for x in input().split()]
	t.append(s[0])
	d.append(s[1])
if n <= 2:
	print(n)
else:
	p = 2
	for i in range(n - 2):
		if t[i + 1] - t[i] > d[i + 1]:
			p += 1
		elif t[i + 2] - t[i + 1] > d[i + 1]:
			p += 1
			t[i + 1] += d[i + 1]
	print(p)


n = int(input())
x = []
h = []
for i in range(n):
	s = input()
	s1 = s.split()
	x.append(int(s1[0]))
	h.append(int(s1[1]))
dp = [[0 for i in range(3)] for j in range(len(x))]
for i in range(len(x)):
	for j in range(3):
		if j == 0:
			if i > 0:
				dp[i][j] = max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
			else:
				dp[i][j] = 0
		elif j == 1:
			if i > 0:
				if x[i] - h[i] > x[i - 1]:
					dp[i][j] = max(dp[i - 1][0], dp[i - 1][1])
				if h[i] + h[i - 1] < x[i] - x[i - 1]:
					dp[i][j] = max(dp[i][j], dp[i - 1][2])
			dp[i][j] = dp[i][j] + 1
		elif i + 1 < len(x) and x[i] + h[i] < x[i + 1]:
			dp[i][j] = max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2]) + 1
		elif i + 1 == len(x):
			dp[i][j] = max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2]) + 1
if len(x) == 1:
	print(1)
else:
	print(max(dp[len(x) - 1][0], dp[len(x) - 1][1], dp[len(x) - 1][2]))


n = int(input())
tree = []
dp = [[0 for i in range(3)] for i in range(n)]
for i in range(n):
	tree.append(list(map(int, input().split())))
dp[0][1] = 1
dp[0][2] = 1
ans = 1
prev = tree[0][0]
for i in range(1, n - 1):
	currX = tree[i][0]
	h = tree[i][1]
	if currX - h > prev:
		prev = currX
		ans += 1
	elif currX + h < tree[i + 1][0]:
		prev = currX + h
		ans += 1
	else:
		prev = currX
if n >= 2:
	ans += 1
print(ans)


n = int(input())
coord = []
heights = []
for i in range(n):
	(c, h) = map(int, input().split())
	coord.append(c)
	heights.append(h)
if n == 1:
	print(1)
else:
	fall = [0] * (n - 2)
	fall = [-1] + fall
	fall = fall + [1]
	for i in range(1, n - 1):
		if fall[i - 1] == -1 or fall[i - 1] == 0:
			if heights[i] < coord[i] - coord[i - 1]:
				fall[i] = -1
			elif heights[i] < coord[i + 1] - coord[i]:
				fall[i] = 1
			else:
				fall[i] = 0
		elif heights[i - 1] + heights[i] < coord[i] - coord[i - 1]:
			fall[i] = -1
		elif heights[i] < coord[i + 1] - coord[i]:
			fall[i] = 1
		else:
			fall[i] = 0
	count = 0
	for i in fall:
		if i != 0:
			count += 1
	print(count)


n = int(input())
x = []
h = []
for i in range(n):
	(a, b) = map(int, input().split())
	x.append(a)
	h.append(b)
b = -10 ** 10
count = 0
for i in range(n):
	l = x[i] - h[i]
	if i == n - 1:
		count += 1
		break
	if l > b:
		count += 1
		b = x[i]
	elif i + 1 < n and x[i + 1] > x[i] + h[i]:
		count += 1
		b = x[i] + h[i]
	else:
		b = x[i]
print(count)


n = int(input())
(x, h) = ([], [])
for i in range(n):
	(xi, hi) = map(int, input().split())
	x += [xi]
	h += [hi]
lx = x[0]
cnt = min(n, 2)
for i in range(1, n - 1):
	if x[i] - lx > h[i]:
		cnt += 1
		lx = x[i]
	elif x[i + 1] - x[i] > h[i]:
		cnt += 1
		lx = x[i] + h[i]
	else:
		lx = x[i]
print(cnt)


n = int(input())
l = []
for i in range(n):
	c = [int(x) for x in input().split()]
	l.append(c)
cnt = 1
pv = l[0][0]
for i in range(1, n - 1):
	if l[i][0] - l[i][1] > pv:
		cnt += 1
		pv = l[i][0]
	elif l[i][0] + l[i][1] < l[i + 1][0]:
		cnt += 1
		pv = l[i][0] + l[i][1]
	else:
		pv = l[i][0]
if n > 1:
	cnt += 1
print(cnt)


def res():
	n = int(input())
	a = []
	b = []
	for i in range(n):
		(l, m) = map(int, input().split())
		a.append(l)
		b.append(m)
	ans = 2
	h = a[0]
	for i in range(1, n - 1):
		if h < a[i] - b[i]:
			ans = ans + 1
			h = a[i]
		elif a[i] + b[i] < a[i + 1]:
			ans = ans + 1
			h = a[i] + b[i]
		else:
			h = a[i]
	if n == 1:
		print(1)
	else:
		print(ans)
res()


n = int(input())
a = []
for i in range(n):
	(x, h) = map(int, input().split())
	a.append((x, h))
x = 1
b = a[0][0]
for i in range(1, n - 1):
	k = a[i]
	s = a[i + 1]
	if k[0] - k[1] > b:
		x += 1
		b = k[0]
		continue
	if k[0] + k[1] < s[0]:
		x += 1
		b = k[0] + k[1]
		continue
	b = k[0]
if n == 1:
	print(1)
else:
	print(x + 1)


import sys
inf = float('inf')
from math import ceil, floor, log, log2, sqrt, factorial, pow, pi, gcd

def powerMod(x, y):
	res = 1
	while y > 0:
		if y & 1:
			res = res * x
		y = y >> 1
		x = x * x
	return res
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
(mod, MOD) = (1000000007, 998244353)
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
n = int(input())
x = []
height = []
for i in range(n):
	(a, b) = get_ints()
	x.append(a)
	height.append(b)
if n == 1:
	print(1)
	exit()
count = 1
for i in range(1, n - 1):
	hi = height[i]
	xi = x[i]
	if xi - hi > x[i - 1]:
		count += 1
	elif xi + hi < x[i + 1]:
		count += 1
		x[i] = xi + hi
count += 1
print(count)


from random import randint

def maxNumberOfCutTreesDP(n, x, h):
	x.append(float('inf'))
	h.append(0)
	(prevLeft, prevStay, prevRight) = (1, 0, canFallRight(0, x, h))
	for i in range(1, n):
		left = canFallLeft(i, x, h) and 1 + max(prevLeft, prevStay, canFallLeftIfPrevRight(i, x, h) and prevRight)
		stay = max(prevLeft, prevStay, prevRight)
		right = canFallRight(i, x, h) and 1 + max(prevLeft, prevStay, prevRight)
		(prevLeft, prevStay, prevRight) = (left, stay, right)
	return max(prevLeft, prevStay, prevRight)

def canFallLeft(i, x, h):
	return int(x[i] - h[i] > x[i - 1])

def canFallRight(i, x, h):
	return int(x[i] + h[i] < x[i + 1])

def canFallLeftIfPrevRight(i, x, h):
	return int(x[i - 1] + h[i - 1] < x[i] - h[i])

def maxNumberOfCutTreesGreedy(n, x, h):
	maxNumTrees = 1
	for i in range(1, n - 1):
		if canFallLeft(i, x, h):
			maxNumTrees += 1
		elif canFallRight(i, x, h):
			maxNumTrees += 1
			x[i] += h[i]
	return maxNumTrees if n == 1 else maxNumTrees + 1

def getPositionsAndHeights(n):
	(x, h) = ([], [])
	for i in range(n):
		(xi, hi) = map(int, input().split())
		x.append(xi)
		h.append(hi)
	return (x, h)
n = int(input())
(x, h) = getPositionsAndHeights(n)
print(maxNumberOfCutTreesGreedy(n, x, h))


n = int(input())
M = [list(map(int, input().split())) for i in range(n)]
k = 1
for i in range(1, n - 1):
	if M[i][0] - M[i][1] > M[i - 1][0]:
		k = k + 1
	elif M[i][0] + M[i][1] < M[i + 1][0]:
		M[i][0] = M[i][0] + M[i][1]
		k = k + 1
if n == 2:
	k = 2
if n >= 3:
	k = k + 1
print(k)


m = int(input())
x = []
h = []
for k in range(m):
	q = [int(i) for i in input().split(' ')]
	x.append(q[0])
	h.append(q[1])

def main():
	if m <= 2:
		return m
	s = 2
	for i in range(1, m - 1):
		if x[i] - h[i] > x[i - 1]:
			s += 1
			continue
		elif x[i] + h[i] < x[i + 1]:
			s += 1
			x[i] += h[i]
	return s
print(main())


n = int(input())
a = [[None] * 2 for i in range(n)]
r = 2
for i in range(n):
	a[i] = list(map(int, input().split()))
for i in range(1, n - 1):
	if a[i][1] - a[i][0] + a[i - 1][0] < 0:
		r += 1
	elif sum(a[i]) - a[i + 1][0] < 0:
		r += 1
		a[i][0] += a[i][1]
if n >= 2:
	print(r)
else:
	print(1)


n = int(input())
dp = [[0 for i in range(2)] for j in range(n)]
x = []
h = []
for i in range(n):
	(a, b) = map(int, input().split())
	x.append(a)
	h.append(b)
dp[0][0] = 1
dp[0][1] = x[0]
x.append(2 * 10 ** 9 + 1)
for i in range(1, n):
	if x[i] - h[i] > dp[i - 1][1]:
		dp[i][1] = x[i]
		dp[i][0] = dp[i - 1][0] + 1
	elif x[i] + h[i] < x[i + 1]:
		dp[i][1] = x[i] + h[i]
		dp[i][0] = dp[i - 1][0] + 1
	else:
		dp[i][0] = dp[i - 1][0]
		dp[i][1] = x[i]
print(dp[n - 1][0])


n = int(input())
m = []
j = 2
c = 0
for i in range(n):
	(x, h) = map(int, input().split())
	m.append([x, h])
if n == 1:
	print(1)
else:
	for i in range(1, len(m) - 1):
		x = m[i][0]
		h = m[i][1]
		a = x - m[i - 1][0] - c
		b = m[i + 1][0] - x
		if a <= h:
			if b > h:
				j += 1
				c = h
			else:
				c = 0
		else:
			j += 1
			c = 0
	print(j)


n = int(input())
l = []
for i in range(n):
	lo = input().split()
	l.append((int(lo[0]), int(lo[1])))
l.insert(0, (-1 * 10 ** 9, 0))
l.append((3 * 10 ** 9, 0))
curr = -1 * 10 ** 9
count = 0
for i in range(1, n + 1):
	if l[i][0] - l[i][1] > curr:
		count += 1
		curr = l[i][0]
	elif l[i + 1][0] - l[i][1] > l[i][0]:
		count += 1
		curr = l[i][0] + l[i][1]
	else:
		curr = l[i][0]
print(count)


n = int(input())
trees = []
for i in range(n):
	trees.append(list(map(int, input().strip().split())))
pre = -float('inf')
c = 1
for i in range(n - 1):
	x = trees[i][0]
	h = trees[i][1]
	if x - h > pre:
		pre = x
		c += 1
	elif x + h < trees[i + 1][0]:
		c += 1
		pre = x + h
	else:
		pre = x
print(c)


n = int(input())
tree = []
for y in range(n):
	(x, h) = map(int, input().split())
	tree.append((x, h))
count = 1
pre = tree[0][0]
if n == 1:
	print(1)
else:
	for num in range(1, n - 1):
		i = tree[num]
		j = tree[num + 1]
		if i[0] > i[1] + pre:
			pre = i[0]
			count += 1
		elif i[0] + i[1] < j[0]:
			pre = i[0] + i[1]
			count += 1
		else:
			pre = i[0]
	print(count + 1)


n = int(input())
dist = []
height = []
for i in range(n):
	(d, h) = map(int, input().split())
	dist.append(d)
	height.append(h)
cut_count = 2
for i in range(1, n - 1):
	if dist[i] - height[i] > dist[i - 1]:
		cut_count += 1
	elif dist[i] + height[i] < dist[i + 1]:
		cut_count += 1
		dist[i] = dist[i] + height[i]
if n == 1:
	print(1)
else:
	print(cut_count)


def main():
	l = list((tuple(map(int, input().split())) for _ in range(int(input()))))
	l.append((10 ** 10, 0))
	nxt = {0: -10 ** 9}
	for ((x1, h1), (x2, h2)) in zip(l, l[1:]):
		(cur, nxt) = (nxt, {})
		for (cnt, mi) in cur.items():
			if x1 - h1 > mi:
				if cnt + 1 in nxt:
					nxt[cnt + 1].append(x1)
				else:
					nxt[cnt + 1] = [x1]
			else:
				if cnt in nxt:
					nxt[cnt].append(x1)
				else:
					nxt[cnt] = [x1]
				if x1 + h1 < x2:
					cnt += 1
					if cnt in nxt:
						nxt[cnt].append(x1 + h1)
					else:
						nxt[cnt] = [x1 + h1]
		for (cnt, mi) in nxt.items():
			nxt[cnt] = min(mi)
		tmp = []
		for (cnt, mi) in nxt.items():
			if any((cnt <= k and mi > v or (cnt < k and mi >= v) for (k, v) in nxt.items())):
				tmp.append(cnt)
		for cnt in tmp:
			del nxt[cnt]
	print(max(nxt.keys()))
main()


cont = 2
n = int(input())
tre = []
for i in range(n):
	(a, b) = map(int, input().split())
	tre.append((a, b))
anterior = tre[0][0]
for i in range(1, n - 1):
	atual = tre[i]
	if atual[0] - atual[1] > anterior:
		cont += 1
		anterior = atual[0]
	elif atual[0] + atual[1] < tre[i + 1][0]:
		cont += 1
		anterior = atual[0] + atual[1]
	else:
		anterior = atual[0]
if n == 1:
	cont -= 1
print(cont)


t = int(input())
dp = [0] * t
lis = []
for _ in range(t):
	(x, y) = [int(i) for i in input().split()]
	lis.append([x, y])
count = min(2, t)
prev = lis[0][0]
for i in range(1, t - 1):
	after = lis[i + 1][0]
	height = lis[i][1]
	if lis[i][0] - height <= prev:
		prev = lis[i][0]
		if lis[i][0] + height < after:
			count += 1
			prev = lis[i][0] + height
	else:
		count += 1
		prev = lis[i][0]
print(count)


from sys import stdin, setrecursionlimit
setrecursionlimit(1500000)
n = int(stdin.readline().strip())
trees = []
for i in range(n):
	trees.append(list(map(int, stdin.readline().split())))
count = 1
last = trees[0][0]
i = 1
while i < n:
	(x, h) = trees[i]
	if i + 1 < n:
		if x - h > last:
			count += 1
			last = x
			i += 1
			continue
		elif x + h < trees[i + 1][0]:
			count += 1
			last = x + h
			i += 1
			continue
		else:
			last = x
			i += 1
			continue
	else:
		count += 1
		i += 1
print(count)


import sys
n = int(input())
trees = [tuple(map(int, input().split()))]
if n == 1:
	print(1)
	sys.exit()
(left, right, erect) = ([1], [0], [0])
(x, h) = map(int, input().split())
erect.append(max(left[-1], right[-1], erect[-1]))
if x - h > trees[-1][0] + trees[-1][1]:
	left.append(max(erect[-2], left[-1], right[-1]) + 1)
elif x - h > trees[-1][0]:
	left.append(max(erect[-2], left[-1]) + 1)
trees.append((x, h))
for i in range(2, n):
	(x, h) = map(int, input().split())
	if trees[-1][0] + trees[-1][1] < x:
		right.append(erect[-1] + 1)
	erect.append(max(left[-1], right[-1], erect[-1]))
	if x - h > trees[-1][0] + trees[-1][1]:
		left.append(max(erect[-2], left[-1], right[-1]) + 1)
	elif x - h > trees[-1][0]:
		left.append(max(erect[-2], left[-1]) + 1)
	trees.append((x, h))
right.append(erect[-1] + 1)
print(right[-1])


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [input() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [int(input()) for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

class PriorityQueue:

	def __init__(self, l=[]):
		self.q = l
		heapq.heapify(self.q)
		return

	def push(self, n):
		heapq.heappush(self.q, n)
		return

	def pop(self):
		return heapq.heappop(self.q)

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def main():
	N = Scanner.int()
	(X, H) = ([], [])
	for _ in range(N):
		(x, h) = Scanner.map_int()
		X.append(x)
		H.append(h)
	if N == 1:
		print(1)
		return
	ans = 2
	for i in range(1, N - 1):
		if X[i - 1] < X[i] - H[i]:
			ans += 1
		elif X[i] + H[i] < X[i + 1]:
			X[i] += H[i]
			ans += 1
	print(ans)
main()


n = int(input())
a = []
for i in range(n):
	(x, y) = map(int, input().split())
	a.append((x, y))
last = (-10) ** 11
ans = 1
for i in range(n - 1):
	(x, y) = a[i]
	now = x - y
	if now > last:
		last = x
		ans += 1
		continue
	now = x + y
	(xx, yy) = a[i + 1]
	if now < xx:
		last = now
		ans += 1
		continue
	last = x
print(ans)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max, nsmallest, nlargest
INF = 99999999999999999999999999999999

def main():
	mod = 1000000007
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	tc = 1
	for _ in range(tc):
		n = ri()
		(x, h) = ([-1], [-1])
		for i in range(n):
			(a, b) = ria()
			x.append(a)
			h.append(b)
		x.append(INF)
		h.append(INF)
		dp = [[-1] * 3 for i in range(n + 1)]
		dp[1][0] = 0
		dp[1][1] = 1
		if len(x) == 2 or x[1] + h[1] < x[2]:
			dp[1][2] = 1
		for i in range(2, n + 1):
			dp[i][0] = max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
			if x[i] - h[i] > x[i - 1]:
				dp[i][1] = 1 + dp[i - 1][0]
				if dp[i - 1][1] != -1:
					dp[i][1] = max(dp[i][1], 1 + dp[i - 1][1])
			if x[i] - h[i] > x[i - 1] + h[i - 1] and dp[i - 1][2] != -1:
				dp[i][1] = max(dp[i][1], 1 + dp[i - 1][2])
			if x[i] + h[i] < x[i + 1]:
				dp[i][2] = 1 + dp[i - 1][0]
				if dp[i - 1][1] != -1:
					dp[i][2] = max(dp[i][2], 1 + dp[i - 1][1])
				if dp[i - 1][2] != -1:
					dp[i][2] = max(dp[i][2], 1 + dp[i - 1][2])
		print(dp[n][2])
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


n = int(input())
x = []
h = []
if n == 1:
	print(1)
else:
	for _ in range(n):
		(a, b) = map(int, input().split())
		x.append(a)
		h.append(b)
	count = 2
	l = x[0] + 1
	for j in range(1, n - 1):
		h1 = h[j]
		if x[j] - l >= h1:
			count += 1
			l = x[j] + 1
		elif x[j + 1] - x[j] - 1 >= h1:
			count += 1
			l = x[j] + h1 + 1
		else:
			l = x[j] + 1
	print(count)


n = int(input())
a = []
for i in range(n):
	(x, h) = map(int, input().split())
	a.append([x, h])
num = 1
i = 1
while i < n - 1:
	if a[i][1] < a[i][0] - a[i - 1][0]:
		num += 1
	elif a[i][1] < a[i + 1][0] - a[i][0]:
		num += 1
		a[i][0] += a[i][1]
	i += 1
if n >= 2:
	num += 1
print(num)


import sys, math, time
start_time = time.time()

def read():
	return int(input())

def read_args():
	return map(int, input().split())

def read_array():
	return list(map(int, input().split()))

def read_string():
	return input().strip()

def hocus_pocus():
	n = read()
	a = [0] * n
	h = [0] * n
	for i in range(n):
		(a[i], h[i]) = read_args()
	ans = min(n, 2)
	for i in range(1, n - 1):
		if a[i] - h[i] > a[i - 1]:
			ans += 1
		elif a[i] + h[i] < a[i + 1]:
			ans += 1
			a[i] += h[i]
	print(ans)
if __debug__:
	input = sys.stdin.readline
else:
	sys.stdin = open('D:\\pro_code\\py\\in.txt', 'r')
	sys.stdout = open('D:\\pro_code\\py\\out.txt', 'w')
global tc
tt = 1
for tc in range(tt):
	hocus_pocus()
if not __debug__:
	print('Time elapsed :', time.time() - start_time, 'seconds')
	sys.stdout.close()


def main():
	(n, ans) = (int(input()), 2)
	a = [tuple(map(int, input().split())) for i in range(n)]
	last = a[0][0]
	ans = min(2, n)
	for i in range(1, n - 1):
		if a[i][0] - a[i][1] > last:
			ans += 1
			last = a[i][0]
		elif a[i][0] + a[i][1] < a[i + 1][0]:
			last = a[i][0] + a[i][1]
			ans += 1
		else:
			last = a[i][0]
	print(ans)
main()


n = int(input())
a = []
for i in range(n):
	a.append([int(i) for i in input().split()])
predk = a[0][0]
if n >= 2:
	sm = 2
else:
	sm = n
for i in range(1, n - 1):
	if predk < a[i][0] - a[i][1]:
		sm += 1
		predk = a[i][0]
	elif a[i][0] + a[i][1] < a[i + 1][0]:
		sm += 1
		predk = a[i][0] + a[i][1]
	else:
		predk = a[i][0]
print(sm)


R = lambda : map(int, input().split())
n = int(input())
arr = [list(R()) for _ in range(n)]
if n <= 2:
	print(n)
	exit(0)
res = 2
for i in range(1, n - 1):
	if arr[i][0] - arr[i][1] > arr[i - 1][0]:
		res += 1
	elif arr[i][0] + arr[i][1] < arr[i + 1][0]:
		res += 1
		arr[i][0] += arr[i][1]
print(res)


n = int(input())
weidian = []
changdu = []
s = 2
for i in range(n):
	w = list(map(int, input().split()))
	weidian.append(w[0])
	changdu.append(w[1])
if n == 1:
	print('1')
else:
	for i in range(1, n - 1):
		if weidian[i] - changdu[i] > weidian[i - 1]:
			s += 1
		elif weidian[i] + changdu[i] < weidian[i + 1]:
			s += 1
			weidian[i] += changdu[i]
	print(s)


n = int(input())
dp = [[0, 0, 0] for _ in range(n + 1)]
dp[1] = [0, 1, 1]
prev = [-999, 0]
for j in range(1, n + 1):
	(pos, height) = map(int, input().split(' '))
	dp[j][0] = max(dp[j - 1][0], max(dp[j - 1][1], dp[j - 1][2] if prev[0] + prev[1] < pos else 0))
	dp[j][1] = 1 + max(dp[j - 1][0] if pos - height > prev[0] else 0, max(dp[j - 1][1] if pos - height > prev[0] else 0, dp[j - 1][2] if prev[0] + prev[1] < pos - height else 0))
	dp[j][2] = 1 + max(dp[j - 1][0], max(dp[j - 1][1], dp[j - 1][2] if prev[0] + prev[1] < pos else 0))
	prev = [pos, height]
print(max(dp[n]))


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


import pdb

def solve(n, trees):
	if n == 1:
		return 1
	dp = [[None for _ in range(3)] for _ in range(n - 1)]
	for (i, (x, h)) in enumerate(trees[:n - 1]):
		if i == 0:
			dp[i][0] = 0
			dp[i][1] = 1 if x + h < trees[i + 1][0] else -float('inf')
			dp[i][2] = 1
		else:
			mx = max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
			dp[i][0] = mx
			dp[i][1] = 1 + mx if x + h < trees[i + 1][0] else -float('inf')
			lst = [-float('inf')]
			if trees[i - 1][0] + trees[i - 1][1] < x - h:
				lst.append(dp[i - 1][1])
			if trees[i - 1][0] < x - h:
				lst.append(dp[i - 1][0])
				lst.append(dp[i - 1][2])
			dp[i][2] = 1 + max(lst)
	return max(dp[n - 2][0], dp[n - 2][1], dp[n - 2][2]) + 1

def main():
	n = int(input())
	trees = []
	for i in range(n):
		(x, h) = map(int, input().split())
		trees.append((x, h))
	sol = solve(n, trees)
	print(sol)
main()


n = int(input())
trees = []
for _ in range(n):
	(a, b) = map(int, input().split())
	trees.append([a, b])
occ = trees[0][0]
ans = 1
for i in range(1, n):
	cur = trees[i]
	if cur[0] - cur[1] > occ:
		ans += 1
		occ = cur[0]
	elif i == n - 1:
		ans += 1
	elif cur[0] + cur[1] < trees[i + 1][0]:
		ans += 1
		occ = cur[0] + cur[1]
	else:
		occ = cur[0]
print(ans)


n = int(input())
arr = []
for _ in range(n):
	arr.append(tuple(map(int, input().split())))
count = 0
occ = arr[0][0]
for i in range(1, n - 1):
	if arr[i][0] - arr[i][1] > occ:
		occ = arr[i][0]
		count = count + 1
	elif arr[i][0] + arr[i][1] < arr[i + 1][0]:
		occ = arr[i][0] + arr[i][1]
		count = count + 1
	else:
		occ = arr[i][0]
if n > 1:
	count = count + 2
else:
	count = 1
print(count)


n = int(input())
l = []
d = []
for i in range(n):
	(t1, t2) = map(int, input().split())
	l.append(t1)
	d.append(t2)
if n >= 2:
	out = 2
elif n < 2:
	out = n
for i in range(1, n - 1):
	if d[i] < l[i] - l[i - 1]:
		out += 1
	elif d[i] < l[i + 1] - l[i]:
		out += 1
		l[i] += d[i]
print(out)


n = int(input())
ts = []
for _ in range(n):
	ts.append(tuple(map(int, input().split())))
ts = sorted(ts, key=lambda e: e[0])
min_occ = -float('inf')
n = 0
for (i, (p, h)) in enumerate(ts):
	try:
		if p - h > min_occ:
			n += 1
			min_occ = p
		elif p + h < ts[i + 1][0]:
			n += 1
			min_occ = p + h
		else:
			min_occ = p
	except IndexError:
		n += 1
print(n)


n = int(input())
trees = []
heights = []
for i in range(n):
	(a, b) = [int(i) for i in input().split()]
	trees.append(a)
	heights.append(b)
if n <= 2:
	print(n)
else:
	dp = [[[0, 0] for i in range(2)] for j in range(n)]
	for i in range(n):
		if i == 0:
			dp[i][0] = [trees[i], 1]
			if trees[i + 1] - trees[i] < heights[i]:
				dp[i][1] = [trees[i] + heights[i], 1]
		elif i == n - 1:
			dp[i][0] = [trees[i], max(dp[i - 1][0][1] + (trees[i] - trees[i - 1] > heights[i]), dp[i - 1][1][1] + (trees[i] - dp[i - 1][1][0] > heights[i]))]
			dp[i][1] = [trees[i] + heights[i], max(dp[i - 1][0][1], dp[i - 1][1][1]) + 1]
		else:
			left = dp[i - 1][0][0]
			right = dp[i - 1][1][0]
			left_score = dp[i - 1][0][1]
			right_score = dp[i - 1][1][1]
			ll = [trees[i], left_score + (trees[i] - left > heights[i])]
			rl = [trees[i], right_score + (trees[i] - right > heights[i])]
			lr = [trees[i] + heights[i] * (trees[i + 1] - trees[i] > heights[i]), left_score + (trees[i + 1] - trees[i] > heights[i])]
			rr = [trees[i] + heights[i] * (trees[i + 1] - trees[i] > heights[i]), right_score + (trees[i + 1] - trees[i] > heights[i])]
			if ll[1] == rl[1]:
				dp[i][0] = [min(ll[0], rl[0]), ll[1]]
			else:
				dp[i][0] = ll if ll[1] > rl[1] else rl
			if lr[1] == rr[1]:
				dp[i][1] = [min(lr[0], rr[0]), lr[1]]
			else:
				dp[i][1] = lr if lr[1] > rr[1] else rr
	print(max(dp[n - 1][0][1], dp[n - 1][1][1]))


from collections import *
from itertools import *
from random import *
from bisect import *
from string import *
from queue import *
from heapq import *
from math import *
from sys import *
from re import *

def fast():
	return stdin.readline().strip()

def zzz():
	return [int(i) for i in fast().split()]
(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def output(answer):
	stdout.write(str(answer))
dx = [-1, 1, 0, 0, 1, -1, 1, -1]
dy = [0, 0, 1, -1, 1, -1, -1, 1]
num = int(z())
lst = []
for i in range(num):
	lst.append(zzz())
cnt = 1
for i in range(1, num - 1):
	curr = lst[i]
	nxt = lst[i + 1]
	if lst[i][0] - lst[i][1] > lst[i - 1][0]:
		cnt += 1
		prev = curr
	elif lst[i][0] + lst[i][1] < lst[i + 1][0]:
		cnt += 1
		lst[i][0] += lst[i][1]
print(max(1, cnt + 1 if num >= 2 else 0))


n = int(input())
trees = []
if n == 1:
	ans = 1
else:
	ans = 2
for _ in range(n):
	(x, h) = map(int, input().split())
	trees.append((x, x - h, x + h))
x_ = trees[0][0]
for i in range(1, n - 1):
	if x_ < trees[i][1]:
		x_ = trees[i][0]
		ans += 1
	elif trees[i][2] < trees[i + 1][0]:
		x_ = trees[i][2]
		ans += 1
	else:
		x_ = trees[i][0]
print(ans)


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 = n
X = []
H = []
while s > 0:
	(x, h) = map(int, input().split())
	X += [x]
	H += [h]
	s -= 1
if n == 0 or n == 1:
	print(n)
else:
	Y = [0]
	for i in range(1, n - 1):
		if X[i] - H[i] > X[i - 1] and X[i] - H[i] > Y[-1]:
			Y += [X[i] - H[i]]
			continue
		if X[i] + H[i] < X[i + 1]:
			Y += [X[i] + H[i]]
	print(len(Y) + 1)


n = int(input())
xhpair = []
for i in range(n):
	s = [int(x) for x in input().split()]
	x = s[0]
	h = s[1]
	xhpair.append((x, h))
ncount = 2
pre = xhpair[0][0]
for k in range(1, n - 1):
	i = xhpair[k]
	j = xhpair[k + 1]
	if i[0] - pre > i[1]:
		ncount += 1
		pre = i[0]
	elif i[0] + i[1] < j[0]:
		ncount += 1
		pre = i[0] + i[1]
	else:
		pre = i[0]
if n > 1:
	print(ncount)
else:
	print(1)


t = int(input())
l = []
x = []
h = []
for i in range(t):
	l.append(list(map(int, input().split())))
for i in range(t):
	x.append(l[i][0])
	h.append(l[i][1])
c = 0
d = x[0]
i = 1
while i < t - 1:
	if x[i] - h[i] > d:
		c += 1
		d = x[i]
	elif x[i] + h[i] < x[i + 1]:
		c += 1
		d = x[i] + h[i]
	else:
		d = x[i]
	i += 1
if t == 1:
	print(1)
else:
	print(c + 2)


n = int(input())
k = 0
x = []
h = []
prev = -10 ** 9
for i in range(n):
	(a, b) = map(int, input().split())
	x.append(a)
	h.append(b)
for i in range(n):
	if i == 0:
		k += 1
		prev = x[i]
	elif i == n - 1:
		k += 1
	elif x[i] - h[i] > prev:
		prev = x[i]
		k += 1
	elif x[i] + h[i] < x[i + 1]:
		prev = x[i] + h[i]
		k += 1
	else:
		prev = x[i]
print(k)


n = int(input())
l = []
for i in range(n):
	(a, b) = [int(x) for x in input().split()]
	l.append((a, b))
no = 2
pre = l[0][0]
for i in range(1, n - 1):
	n1 = l[i]
	n2 = l[i + 1]
	if n1[0] - pre > n1[1]:
		no = no + 1
		pre = n1[0]
		continue
	if n1[0] + n1[1] < n2[0]:
		no = no + 1
		pre = n1[0] + n1[1]
		continue
	else:
		pre = n1[0]
if n == 1:
	print(1)
else:
	print(no)


n = int(input())
S = []
for i in range(n):
	S.append([int(x) for x in input().split()])
S.append([10 ** 10, 0])
ans = 0
lastone = -10 ** 10
for i in range(n):
	if S[i][0] - S[i][1] > lastone:
		ans += 1
		lastone = S[i][0]
	elif S[i][0] + S[i][1] < S[i + 1][0]:
		ans += 1
		lastone = S[i][0] + S[i][1]
	else:
		lastone = S[i][0]
print(ans)


from math import inf
n = int(input())
x = []
h = []
for i in range(n):
	(a, b) = map(int, input().split())
	x.append(a)
	h.append(b)
dp = [[-inf for i in range(3)] for j in range(n)]
dp[0] = [0, 1, 1]
p = [x[0], x[0], x[0] + h[0]]
for i in range(1, n):
	m = -inf
	for j in range(3):
		if x[i] > p[j]:
			m = max(m, dp[i - 1][j])
	dp[i][0] = m
	dp[i][2] = m + 1
	m = -inf
	for j in range(3):
		if x[i] - h[i] > p[j]:
			m = max(m, dp[i - 1][j])
	dp[i][1] = m + 1
	p[0] = x[i]
	p[1] = x[i]
	p[2] = x[i] + h[i]
print(max(dp[n - 1]))


from sys import stdin
n = int(input())
l = [[] for i in range(n)]
for i in range(n):
	l1 = list(map(int, stdin.readline().rstrip().split(' ')))
	l[i] = l1
t = l[0][0]
c = 2
if n < 3:
	print(n)
else:
	for i in range(1, n - 1):
		(x, h) = (l[i][0], l[i][1])
		if x - h > t:
			c += 1
			t = x
		elif x + h < l[i + 1][0]:
			c += 1
			t = x + h
		else:
			t = x
	print(c)


n = int(input())
trees = [tuple(map(int, input().split())) for i in range(n)]
prevx = -1000000000000000.0
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)


from __future__ import print_function
import sys
from collections import *
from heapq import *
INF = float('inf')
NINF = float('-inf')
try:
	input = raw_input
except:
	pass

def read_string():
	return input()

def read_int_line():
	return [int(x) for x in input().split(' ')]

def read_int():
	return int(input())

class TreeNode(object):

	def __init__(self, x):
		self.val = x
		self.left = None
		self.right = None

	def __str__(self):
		q = deque()
		ans = []
		q.append(self)
		ans.append(self.val)
		while q:
			cur = q.popleft()
			ans.append(cur.left.val if cur.left else 'null')
			ans.append(cur.right.val if cur.right else 'null')
			if cur.left:
				q.append(cur.left)
			if cur.right:
				q.append(cur.right)
		while ans and ans[-1] == 'null':
			ans.pop()
		return str(ans).replace("'null'", 'null')

def toTreeNode(s):
	l = eval(s.replace('null', 'None'))
	n = len(l)
	if not n:
		return None
	root = TreeNode(l[0])
	q = deque()
	q.append(root)
	i = 1
	while q and i < n:
		cur = q.popleft()
		if l[i] != None:
			cur.left = TreeNode(l[i])
			q.append(cur.left)
		i += 1
		if i >= n:
			break
		if l[i] != None:
			cur.right = TreeNode(l[i])
			q.append(cur.right)
		i += 1
	return root

class Djs:

	def __init__(self, n):
		self.w = [1] * n
		self.p = [-1] * n

	def find(self, x):
		p = self.p[x]
		if p == -1:
			return x
		else:
			self.p[x] = self.find(p)
			return self.p[x]

	def union(self, x, y):
		(x, y) = (self.find(x), self.find(y))
		if x == y:
			return
		if self.w[x] > self.w[y]:
			(x, y) = (y, x)
		self.p[x] = y
		self.w[y] += self.w[x]

	def roots(self):
		return [x for (x, y) in enumerate(self.p) if y == -1]

def doit():
	n = read_int()
	l = []
	for _ in range(n):
		(x, h) = read_int_line()
		l.append((x, h))
	ans = 0
	lastx = -1
	for (i, (x, h)) in enumerate(l):
		if i == 0:
			ans += 1
			lastx = x
		elif x - h > lastx:
			ans += 1
			lastx = x
		elif i + 1 == n or x + h < l[i + 1][0]:
			ans += 1
			lastx = x + h
		else:
			lastx = x
	print('%d' % ans)
try:
	while True:
		doit()
except EOFError:
	pass


import sys
input = lambda : sys.stdin.readline().rstrip()
inf = 10 ** 18
a = []
n = int(input())
for i in range(n):
	a.append([int(i) for i in input().split()])
a.sort()
occ = [a[0][0] - a[0][1], a[0][0]]
ans = 1
for j in range(1, n):
	i = a[j][:]
	cur1 = [i[0] - i[1], i[0]]
	cur2 = [i[0], i[0] + i[1]]
	if occ[1] < cur1[0]:
		occ[1] = cur1[1]
		ans += 1
	elif occ[1] < cur2[0] and (j + 1 == n or (j + 1 < n and cur2[1] < a[j + 1][0])):
		occ[1] = cur2[1]
		ans += 1
	else:
		occ[1] = i[0]
print(ans)


lis = [[int(x) for x in input().split()] for i in range(int(input()))]
ans = 0
lef_lim = -1000000000
for i in range(len(lis) - 1):
	if lis[i][0] - lis[i][1] > lef_lim:
		ans += 1
		lef_lim = lis[i][0]
	elif lis[i][0] + lis[i][1] < lis[i + 1][0]:
		ans += 1
		lef_lim = lis[i][0] + lis[i][1]
	else:
		lef_lim = lis[i][0]
print(ans + 1)


n = int(input())
dominos = []
for i in range(n):
	dom = input().split()
	dominos.append([int(dom[0]), int(dom[1])])

def knock(dominos):
	s = 2
	for i in range(1, n - 1):
		(x, h) = dominos[i]
		if x - h > dominos[i - 1][0]:
			s += 1
		elif x + h < dominos[i + 1][0]:
			s += 1
			dominos[i][0] += h
	return s if n > 1 else 1
print(knock(dominos))


import math, sys, bisect, heapq
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
int1 = lambda x: int(x) - 1
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))
ilelec = lambda : map(int1, input().split())
alelec = lambda : list(map(int1, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])

def Yy(c):
	print(['No', 'Yes'][c])
n = int(input())
ans = 0
xprev = -1000000000.0
hprev = 0
status = -1
for i in range(n):
	(x, h) = ilele()
	if status == 1:
		if xprev + hprev >= x:
			ans -= 1
			status = -1
	if status == -1:
		if x - h > xprev:
			status = -1
		else:
			status = 1
	elif status == 1:
		if x - h > xprev + hprev:
			status = -1
		else:
			status = 1
	ans += 1
	xprev = x
	hprev = h
print(ans)


n = int(input())
trees = [list(map(int, input().split())) for _ in range(n)]
last_tree = trees[0][0]
cut = 1
for i in range(1, n):
	if trees[i][1] + last_tree >= trees[i][0]:
		if i + 1 != n:
			if trees[i + 1][1] + trees[i][0] > trees[i][0] and trees[i + 1][0] - trees[i][0] > trees[i][1]:
				cut += 1
				last_tree = trees[i][0] + trees[i][1]
			else:
				last_tree = trees[i][0]
		else:
			cut += 1
	else:
		last_tree = trees[i][0]
		cut += 1
print(cut)


n = int(input())
point = []
mark = [[-10000000000, -10000000000]]
c = 0
for i in range(n):
	(a, b) = map(int, input().split())
	point.append([a, b])
for i in range(n):
	(a, b) = point[i]
	left = [a - b, a]
	right = [a, a + b]
	temp = []
	if mark[i][1] < left[0]:
		temp = left[:]
	if len(temp) == 0:
		r = i + 1
		if r < n:
			if point[r][0] > right[1]:
				temp = right[:]
		else:
			temp = right[:]
	if len(temp) == 0:
		mark.append([a, a])
	else:
		c += 1
		mark.append(temp[:])
print(c)


MOD = 1000000007
MOD2 = 998244353
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
c = 1
n = ii()
(ht, xcr) = ([], [])
for i in range(n):
	(a, b) = f()
	xcr.append(a)
	ht.append(b)
gap = [xcr[i] - xcr[i - 1] for i in range(1, n)]
gap = [10 ** 11] + gap + [10 ** 11]
for i in range(1, n):
	if ht[i] < gap[i]:
		c += 1
	elif ht[i] < gap[i + 1]:
		c += 1
		gap[i + 1] -= ht[i]
print(c)


def possible():
	n_trees = 2
	left = True
	for i in range(1, n - 1):
		(x, h) = trees[i]
		if left == True:
			if x - h > trees[i - 1][0]:
				n_trees += 1
			elif x + h < trees[i + 1][0]:
				n_trees += 1
				left = False
			else:
				left = True
		elif x - h > sum(trees[i - 1]):
			left = True
			n_trees += 1
		elif x + h < trees[i + 1][0]:
			n_trees += 1
		else:
			left = True
	return n_trees
n = int(input())
trees = []
for i in range(n):
	(x, h) = map(int, input().split())
	trees.append((x, h))
if n < 3:
	print(n)
else:
	print(possible())


n = int(input())
res = 1
(x, h) = list(map(int, input().split()))
right = x
for i in range(n - 1):
	x_old = x
	(x, h) = list(map(int, input().split()))
	if x <= right:
		right = x_old
		res -= 1
	res += 1
	if x - h > right:
		right = x
	else:
		right = x + h
print(res)


n = int(input())
a = []
b = []
c = 1
for i in range(n):
	(x, y) = map(int, input().split())
	a.append(x)
	b.append(y)
if n == 1 or n == 2:
	(print(n), exit(0))
for i in range(1, n - 1):
	if a[i] - a[i - 1] > b[i]:
		c += 1
	elif a[i] + b[i] < a[i + 1]:
		c += 1
		a[i] += b[i]
print(c + 1)


import sys
input = sys.stdin.readline
n = int(input())
a = []
for x in range(n):
	i = input().split()
	a.append((int(i[0]), int(i[1])))
dp = [[-float('inf')] * 3 for x in range(n)]
for x in range(n):
	farleft = a[x][0] - a[x][1]
	farright = a[x][0] + a[x][1]
	if x == 0:
		dp[x][0] = 1
	elif farleft > a[x - 1][0] + a[x - 1][1]:
		dp[x][0] = max(dp[x - 1]) + 1
	elif a[x - 1][0] < farleft:
		dp[x][0] = max(dp[x - 1][:2]) + 1
	if x != 0:
		dp[x][1] = max(dp[x - 1])
	else:
		dp[x][1] = 0
	if x == n - 1 or farright < a[x + 1][0]:
		if x != 0:
			dp[x][2] = max(dp[x - 1]) + 1
		else:
			dp[x][2] = 1
print(max(dp[-1]))


inf = 10 ** 18
a = []
n = int(input())
for i in range(n):
	a.append([int(i) for i in input().split()])
a.sort()
occ = [a[0][0] - a[0][1], a[0][0]]
ans = 1
for j in range(1, n):
	i = a[j][:]
	cur1 = [i[0] - i[1], i[0]]
	cur2 = [i[0], i[0] + i[1]]
	if occ[1] < cur1[0]:
		occ[1] = cur1[1]
		ans += 1
	elif occ[1] < cur2[0] and (j + 1 == n or (j + 1 < n and cur2[1] < a[j + 1][0])):
		occ[1] = cur2[1]
		ans += 1
	else:
		occ[1] = i[0]
print(ans)


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


n = int(input())
(hh, xx) = ([], [])
for _ in range(n):
	(x, h) = [int(k) for k in input().split()]
	xx.append(x)
	hh.append(h)
ans = 2 if n > 1 else 1
i = 1
taken = 0
prev_x = xx[0]
while i < len(hh) - 1:
	x = xx[i]
	h = hh[i]
	next_x = xx[i + 1]
	if h < x - prev_x - taken:
		ans += 1
		taken = 0
	elif h < next_x - x:
		ans += 1
		taken = h
	else:
		taken = 0
	prev_x = x
	i += 1
print(ans)


n = int(input())
x = []
h = []
for i in range(n):
	(x_, h_) = list(map(int, input().split()))
	x.append(x_)
	h.append(h_)
dp = [[1, 1, 0]]
for i in range(1, n):
	dp.append([0, 0, 0])
	if x[i - 1] + h[i - 1] < x[i] - h[i]:
		dp[i][0] = max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2]) + 1
	elif x[i] - h[i] <= x[i - 1]:
		dp[i][0] = 0
	else:
		dp[i][0] = max(dp[i - 1][0], dp[i - 1][2]) + 1
	if x[i - 1] + h[i - 1] < x[i]:
		dp[i][1] = max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2]) + 1
	else:
		dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + 1
	if x[i - 1] + h[i - 1] < x[i]:
		dp[i][2] = max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
	else:
		dp[i][2] = max(dp[i - 1][0], dp[i - 1][2])
print(max(dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]))


n = int(input())
x_x = []
r_r = []
if n == 1:
	print(1)
	exit(0)
count = 2
for i in range(n):
	(x, r) = map(int, input().split())
	x_x.append(x)
	r_r.append(r)
for j in range(1, len(x_x) - 1):
	if x_x[j] - r_r[j] > x_x[j - 1]:
		count += 1
	elif x_x[j] + r_r[j] < x_x[j + 1]:
		x_x[j] = x_x[j] + r_r[j]
		count += 1
print(count)


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


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


n = int(input())
A = []
for i in range(n):
	A.append(list(map(int, input().split())))
if n == 1 or n == 2:
	print(n)
else:
	s = 2
	for i in range(1, n - 1):
		if A[i][0] - A[i][1] > A[i - 1][0]:
			s = s + 1
		elif A[i][0] + A[i][1] < A[i + 1][0]:
			s = s + 1
			A[i][0] += A[i][1]
	print(s)


n = int(input())
lst = []
for _ in range(n):
	lst.append(tuple(map(int, input().split(' '))))
res = min(2, n)
right_verge = lst[0][0]
for i in range(1, n - 1, 1):
	if lst[i][0] - lst[i][1] > right_verge:
		res += 1
		right_verge = lst[i][0]
	elif lst[i][0] + lst[i][1] < lst[i + 1][0]:
		res += 1
		right_verge = lst[i][0] + lst[i][1]
	else:
		right_verge = lst[i][0]
print(res)


n = int(input())
x = []
h = []
for i in range(n):
	(x1, h1) = map(int, input().split())
	x.append(x1)
	h.append(h1)
dp = [[0 for i in range(3)] for j in range(n)]
for i in range(n):
	if i == 0:
		dp[i][0] = 0
		dp[i][1] = 1
		try:
			if x[i] + h[i] < x[i + 1] - h[i + 1]:
				dp[i][2] = 1
			elif x[i] + h[i] < x[i + 1]:
				dp[i][2] = 1
			else:
				dp[i][2] = 0
		except:
			dp[i][2] = 1
	elif i == n - 1:
		dp[i][0] = max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
		dp[i][2] = 1 + max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
		if x[i] - h[i] > x[i - 1] + h[i - 1]:
			dp[i][1] = 1 + max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
		elif x[i] - h[i] > x[i - 1]:
			dp[i][1] = 1 + max(dp[i - 1][0], dp[i - 1][1])
		else:
			dp[i][1] = max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
	else:
		dp[i][0] = max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
		if x[i] + h[i] < x[i + 1] - h[i + 1]:
			dp[i][2] = 1 + max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
		elif x[i] + h[i] < x[i + 1]:
			dp[i][2] = 1 + max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
		else:
			dp[i][2] = max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
		if x[i] - h[i] > x[i - 1] + h[i - 1]:
			dp[i][1] = 1 + max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
		elif x[i] - h[i] > x[i - 1]:
			dp[i][1] = 1 + max(dp[i - 1][0], dp[i - 1][1])
		else:
			dp[i][1] = max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
final = max(dp[n - 1][0], dp[n - 1][1], dp[n - 1][2])
print(final)


number = int(input())
x = []
h = []
if number <= 2:
	print(number)
else:
	for i in range(number):
		(a, b) = map(int, input().split())
		x.append(a)
		h.append(b)
	ok = 2
	for i in range(1, number - 1):
		if x[i] - h[i] > x[i - 1]:
			ok += 1
		elif x[i] + h[i] < x[i + 1]:
			ok += 1
			x[i] += h[i]
	print(ok)


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()


import os
import sys
from io import BytesIO, IOBase

def main():
	n = int(input())
	a = []
	for _ in range(n):
		(x, y) = map(int, input().split(' '))
		a.append([x, y])
	ans = 2
	if n == 1:
		print(1)
		return
	for x in range(1, n - 1):
		if a[x][0] - a[x][1] > a[x - 1][0]:
			ans += 1
		elif a[x][0] + a[x][1] < a[x + 1][0]:
			ans += 1
			a[x][0] = a[x][0] + a[x][1]
	print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = int(input())
h = []
for i in range(n):
	h.append(list(map(int, input().split())))
ans = 0
for i in range(n):
	if i == 0 or i == n - 1:
		ans = ans + 1
	elif h[i][1] < h[i][0] - h[i - 1][0]:
		ans = ans + 1
	elif h[i][1] < h[i + 1][0] - h[i][0]:
		ans = ans + 1
		h[i][0] = h[i][0] + h[i][1]
print(ans)


n = int(input())
tree = list()
height = list()
num = 1
for i in range(n):
	(x, h) = [int(x) for x in input().split()]
	tree.append(x)
	height.append(h)
	if i == 0:
		num += 1
	elif i == 1:
		continue
	elif height[i - 1] < tree[i] - tree[i - 1] and height[i - 1] < tree[i - 1] - tree[i - 2]:
		num += 1
	elif height[i - 1] >= tree[i] - tree[i - 1] and height[i - 1] < tree[i - 1] - tree[i - 2]:
		num += 1
	elif height[i - 1] < tree[i] - tree[i - 1] and height[i - 1] >= tree[i - 1] - tree[i - 2]:
		num += 1
		tree[i - 1] += height[i - 1]
	else:
		num = num
if n > 1:
	print(num)
else:
	print('1')


X = []
H = []
n = int(input())
for i in range(n):
	(x, h) = map(int, input().strip().split())
	X.append(x)
	H.append(h)
if n <= 2:
	print(n)
else:
	c = 2
	k = 1
	while k < n - 1:
		x = X[k]
		h = H[k]
		if x - h > X[k - 1]:
			c += 1
		elif x + h < X[k + 1]:
			c += 1
			X[k] += h
		k += 1
	print(c)


n = int(input())
a = []
b = []
for i in range(n):
	inp = input().split()
	a.append(int(inp[1]))
	b.append(int(inp[0]))
if n >= 2:
	count = 2
elif n == 1:
	count = 1
for i in range(1, n - 1):
	if b[i] - b[i - 1] > a[i]:
		count += 1
	elif b[i + 1] - b[i] > a[i]:
		count += 1
		b[i] = b[i] + a[i]
	else:
		continue
print(count)


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)


d = []
h = []
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	d.append(n)
	h.append(k)
cnt = 2
if t <= 2:
	print(t)
	exit()
for i in range(1, t - 1):
	pre = d[i] - d[i - 1]
	po = d[i + 1] - d[i]
	if pre > h[i]:
		cnt += 1
	elif po > h[i]:
		d[i] = d[i] + h[i]
		cnt += 1
print(cnt)


y = int(input())
c = []
h = []
s = []
for i in range(y):
	al = input().split()
	m = list(map(int, al))
	c.append(m[0])
	h.append(m[1])
if y < 2:
	max = y
else:
	max = 2
s.append(-1)
for i in range(1, y - 1):
	if c[i] - c[i - 1] > h[i] and s[i - 1] < 1:
		s.append(-1)
		max += 1
	elif c[i] - c[i - 1] - h[i - 1] > h[i] and s[i - 1] == 1:
		s.append(-1)
		max += 1
	elif c[i + 1] - c[i] > h[i]:
		s.append(1)
		max += 1
	else:
		s.append(0)
s.append(1)
print(max)


n = int(input())
a = []
res = min(n, 2)
left = 0
for i in range(n):
	a.append(list(map(int, input().split())))
	if i == 0:
		left = a[i][0]
	if i > 1:
		if a[i - 1][0] - left > a[i - 1][1]:
			res += 1
			left = a[i - 1][0]
		elif a[i][0] - a[i - 1][0] > a[i - 1][1]:
			res += 1
			left = a[i - 1][0] + a[i - 1][1]
		else:
			left = a[i - 1][0]
print(res)


(pos, h) = ([], [])
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	pos.append(a)
	h.append(b)
right = []
left = []
for i in range(len(h)):
	if i == 0:
		left.append(10 ** 10)
	else:
		left.append(pos[i] - pos[i - 1])
for i in range(len(h)):
	if i == len(h) - 1:
		right.append(10 ** 10)
	else:
		right.append(pos[i + 1] - pos[i])
c = 0
last = 0
for i in range(len(h)):
	if h[i] < left[i]:
		c += 1
	elif h[i] < right[i]:
		if i == len(h) - 1:
			c += 1
		else:
			left[i + 1] -= h[i]
			c += 1
print(c)


import sys, re, math
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from heapq import heappush, heappop, heapify, nlargest, nsmallest

def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def sortListWithIndex(listOfTuples, idx):
	return sorted(listOfTuples, key=lambda x: x[idx])

def sortDictWithVal(passedDic):
	temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
	toret = {}
	for tup in temp:
		toret[tup[0]] = tup[1]
	return toret

def sortDictWithKey(passedDic):
	return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
n = INT()
x = []
h = []
for _ in range(n):
	(x1, h1) = MAP()
	x.append(x1)
	h.append(h1)
fallen = 0
occTillNow = x[0]
for i in range(1, n - 1):
	tree = h[i]
	if tree < x[i] - occTillNow:
		fallen += 1
		occTillNow = x[i]
	elif tree < x[i + 1] - x[i]:
		fallen += 1
		occTillNow = x[i] + tree
	else:
		occTillNow = x[i]
if n == 1:
	print(fallen + 1)
else:
	print(fallen + 2)


n = int(input())
l = 0
r = 0
c = 2
ll = []
for i in range(n):
	(x, h) = map(int, input().split())
	ll.append([x, h])
for i in range(1, n - 1):
	if ll[i][0] - ll[i][1] > ll[i - 1][0]:
		if l != 1:
			c += 1
			r = 1
		elif ll[i - 1][0] + ll[i - 1][1] < ll[i][0] - ll[i][1]:
			c += 1
			r = 1
			l = 0
		elif ll[i + 1][0] > ll[i][0] + ll[i][1]:
			c += 1
			r = 0
			l = 1
		else:
			l = 0
			r = 1
	elif ll[i + 1][0] > ll[i][0] + ll[i][1]:
		c += 1
		r = 0
		l = 1
	else:
		l = 0
		r = 1
if n == 1:
	print(1)
else:
	print(c)


import time
import heapq
import sys
from collections import *
from heapq import *
import math
import bisect
from itertools import *
mod = 10 ** 9 + 7
n = int(input())
l = []
dic = defaultdict(int)
for i in range(n):
	(x, h) = map(int, input().split())
	l.append([x, h])
l.sort(key=lambda x: x[0])
last = -1 * 10 ** 18
cnt = 0
for i in range(n):
	if i == 0:
		last = l[0][0]
		cnt += 1
	elif i == n - 1:
		cnt += 1
	else:
		h = l[i][1]
		x = l[i][0]
		if x - h > last:
			last = x
			cnt += 1
		elif x + h < l[i + 1][0]:
			last = x + h
			cnt += 1
	last = max(last, l[i][0])
print(cnt)


n = int(input())
a = []
for j in range(n):
	a.append(list(map(int, input().split())))
if n <= 2:
	print(n)
else:
	p = a[0][0]
	c = 2
	for j in range(1, n - 1):
		if a[j][0] - a[j][1] > p:
			p = a[j][0]
			c = c + 1
		elif a[j][0] + a[j][1] < a[j + 1][0]:
			p = a[j][0] + a[j][1]
			c = c + 1
		else:
			p = a[j][0]
	print(c)


import sys
n = int(input())
a = [0] * n
b = [0] * n
for i in range(n):
	(a[i], b[i]) = map(int, input().split())
blocked = a[0]
ans = 2
if n == 1:
	print(1)
	sys.exit()
for i in range(1, n - 1):
	if a[i] - b[i] > blocked:
		blocked = a[i]
		ans += 1
	elif a[i] + b[i] < a[i + 1]:
		blocked = a[i] + b[i]
		ans += 1
	else:
		blocked = a[i]
print(ans)


n = int(input())
data = []
for i in range(n):
	(a, b) = 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, k) = (int(input()), 2)
if n < 2:
	(print(1), exit())
a = [[int(i) for i in input().split()] for _ in range(n)]
for i in range(1, n - 1):
	if a[i][0] - a[i][1] > a[i - 1][0]:
		k += 1
	elif a[i][0] + a[i][1] < a[i + 1][0]:
		a[i][0] += a[i][1]
		k += 1
print(k)


n = int(input())
p = -float('INF')
ans = 1
A = []
for i in range(n):
	(x, h) = 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())
arr = [list(map(int, input().split())) for _ in range(n)]
count = 1
for i in range(1, n - 1):
	x = arr[i][0] - arr[i][1]
	y = arr[i][0] + arr[i][1]
	if x > arr[i - 1][0]:
		count += 1
	elif y < arr[i + 1][0]:
		count += 1
		arr[i][0] += arr[i][1]
print(count + 1 if n > 1 else 1)


n = int(input())
posn = []
height = []
for i in range(n):
	tree = list(map(int, input().split()))
	posn.append(tree[0])
	height.append(tree[1])
count = 2
choice = -1
for i in range(1, n - 1):
	if choice <= 0:
		if posn[i] - posn[i - 1] > height[i]:
			choice = -1
			count += 1
		elif posn[i + 1] - posn[i] > height[i]:
			choice = 1
			count += 1
		else:
			choice = 0
	elif posn[i] - posn[i - 1] - height[i - 1] > height[i]:
		choice = -1
		count += 1
	elif posn[i + 1] - posn[i] > height[i]:
		choice = 1
		count += 1
	else:
		choice = 0
if n == 1:
	count = 1
print(count)


trees = []
cut = 0
n = int(input())
for i in range(n):
	(x, h) = map(int, input().split())
	trees.append([x, h])
for tree in range(len(trees)):
	if tree == 0:
		cut += 1
	elif tree == len(trees) - 1:
		cut += 1
	elif trees[tree][0] - trees[tree][1] > trees[tree - 1][0]:
		cut += 1
	elif trees[tree][0] + trees[tree][1] < trees[tree + 1][0]:
		cut += 1
		trees[tree][0] = trees[tree][0] + trees[tree][1]
print(cut)


n = int(input())
arr = []
if n > 1:
	count = 2
else:
	count = 1
for i in range(n):
	(x, h) = map(int, input().split())
	tup = (x, h)
	arr.append(tup)
occupied = []
for i in range(n - 1):
	if i > 0:
		left_temp_tup = (arr[i][0] - arr[i][1], arr[i][0])
		right_temp_tup = (arr[i][0], arr[i][0] + arr[i][1])
		if left_temp_tup[0] > occupied[len(occupied) - 1][1]:
			occupied.append(left_temp_tup)
			count += 1
		elif right_temp_tup[1] < arr[i + 1][0]:
			occupied.append(right_temp_tup)
			count += 1
		else:
			a = (arr[i][0], arr[i][0])
			occupied.append(a)
	else:
		a = (arr[0][0] - arr[0][1], arr[0][0])
		occupied.append(a)
print(count)


trees = [tuple(map(int, input().strip().split())) for _ in range(int(input().strip()))]
n = len(trees)
c = 2
i = 1
while i < n - 1:
	if trees[i][0] - trees[i][1] > trees[i - 1][0]:
		c += 1
	elif trees[i][0] + trees[i][1] < trees[i + 1][0]:
		trees[i] = (trees[i][0] + trees[i][1], 0)
		c += 1
	i += 1
print(min(n, c))


a = int(input())
r = []
for i in range(a):
	(x, y) = map(int, input().split())
	r.append([x, y])
count = 2
for i in range(1, len(r) - 1):
	if r[i][0] - r[i][1] > r[i - 1][0]:
		count = count + 1
	elif r[i][0] + r[i][1] < r[i + 1][0]:
		count = count + 1
		r[i][0] += r[i][1]
print(min(a, count))


n = int(input())
(x, h) = ([0], [0])
for i in range(n):
	(xi, hi) = [int(x) for x in input().split()]
	x.append(xi)
	h.append(hi)
maxt = [[0, 0] for i in range(n + 1)]
maxt[1] = [1, 1]
for i in range(2, n + 1):
	if x[i] - x[i - 1] <= h[i - 1]:
		maxt[i][1] = 1 + maxt[i - 1][0]
		if x[i] - x[i - 1] <= h[i]:
			maxt[i][0] = maxt[i - 1][0]
		else:
			maxt[i][0] = maxt[i - 1][0] + 1
	else:
		maxt[i][1] = 1 + maxt[i - 1][1]
		if x[i] - x[i - 1] <= h[i]:
			maxt[i][0] = maxt[i - 1][1]
		elif h[i] < x[i] - x[i - 1] <= h[i] + h[i - 1]:
			maxt[i][0] = max(1 + maxt[i - 1][0], maxt[i - 1][1])
		else:
			maxt[i][0] = 1 + maxt[i - 1][1]
print(maxt[n][1])


n = int(input())
li = []
for i in range(n):
	r = list(map(int, input().split()))
	li.append(r)
t = 1
last = li[0][0]
for i in range(1, n - 1):
	if li[i][0] - li[i][1] > last:
		t += 1
		last = li[i][0]
	elif li[i][0] + li[i][1] < li[i + 1][0]:
		t += 1
		last = li[i][0] + li[i][1]
	else:
		last = li[i][0]
if n > 1:
	t += 1
print(t)


n = int(input())
a = [0] * (n + 1)
b = [0] * (n + 1)
for i in range(n):
	(a[i], b[i]) = map(int, input().split())
c = [[0] * 2 for i in range(n + 1)]
for i in range(n):
	if i == 0:
		c[i + 1][0] = 1
		c[i + 1][1] = max(c[i][0], c[i][1]) + (a[i] + b[i] < a[i + 1])
	elif i == n - 1:
		c[i + 1][1] = max(c[i][0], c[i][1]) + 1
		c[i + 1][0] = max(c[i][0] + (a[i - 1] < a[i] - b[i]), c[i][1] + (a[i - 1] + b[i - 1] < a[i] - b[i]))
	else:
		c[i + 1][0] = max(c[i][0] + (a[i - 1] < a[i] - b[i]), c[i][1] + (a[i - 1] + b[i - 1] < a[i] - b[i]))
		c[i + 1][1] = max(c[i][0], c[i][1]) + (a[i] + b[i] < a[i + 1])
print(max(c[n][0], c[n][1]))


n = int(input())
dominos = []
for i in range(n):
	dom = input().split()
	dominos.append([int(dom[0]), int(dom[1])])

def knock(dominos):
	n = len(dominos)
	if n == 1:
		return 1
	max_dominos_fell = 2
	for i in range(1, len(dominos) - 1):
		(x, h) = dominos[i]
		if x - h > dominos[i - 1][0]:
			max_dominos_fell += 1
		elif x + h < dominos[i + 1][0]:
			max_dominos_fell += 1
			dominos[i][0] += h
	return max_dominos_fell
print(knock(dominos))


from sys import *

def cut(a):
	if len(a) == 1:
		return 1
	else:
		cuts = 2
		for j in range(1, n - 1):
			if a[j][0] - a[j - 1][0] > a[j][1]:
				cuts = cuts + 1
			elif a[j + 1][0] - a[j][0] > a[j][1]:
				cuts = cuts + 1
				a[j][0] = a[j][0] + a[j][1]
		return cuts
n = int(input())
a = [[0 for x in range(2)] for y in range(n)]
for i in range(n):
	a[i] = list(map(int, input().strip().split()))[:2]
print(cut(a))


n = int(input())
(x, h) = zip(*[map(int, input().split()) for i in range(n)])
dp = [[0, 1, 1]]
for i in range(1, n):
	z = [max(dp[i - 1][0], dp[i - 1][1]), 0, 0]
	if x[i] - x[i - 1] >= h[i - 1] + 1:
		z[0] = max(z[0], dp[i - 1][2])
	if x[i] - x[i - 1] >= h[i] + 1:
		z[1] = 1 + max(dp[i - 1][0], dp[i - 1][1])
	if x[i] - x[i - 1] >= h[i] + h[i - 1] + 1:
		z[1] = max(z[1], 1 + dp[i - 1][2])
	z[2] = z[0] + 1
	dp.append(z)
print(dp[n - 1][2])


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
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)


n = int(input())
trees = []
for i in range(n):
	(x, h) = map(int, input().split())
	trees.append((x, h))
felled = min(2, n)
for i in range(1, n - 1):
	left = trees[i][0] - trees[i][1]
	right = trees[i][0] + trees[i][1]
	if left > trees[i - 1][0]:
		felled += 1
	elif right < trees[i + 1][0]:
		felled += 1
		trees[i] = (trees[i][0] + trees[i][1], trees[i][1])
print(felled)


n = int(input())
list1 = []
list2 = []
for i in range(n):
	list = input().split()
	list1.append(int(list[0]))
	list2.append(int(list[1]))
count = 0
if n >= 2:
	count = 2
if n == 1:
	count = 1
for i in range(1, n - 1):
	left = list1[i - 1]
	right = list1[i + 1]
	position = list1[i]
	height = list2[i]
	if position - height > left:
		count += 1
	elif position + height < right:
		count += 1
		list1[i] = list1[i] + height
print(count)


n = int(input())
if n == 1:
	print(1)
	exit()
if n == 2:
	print(2)
	exit()
alive_trees = []
for i in range(n):
	(x, h) = map(int, input().split())
	alive_trees.append([x, h])
answer = 2
last_killed = alive_trees[0][0]
for i in range(1, n - 1):
	if alive_trees[i][0] - alive_trees[i][1] > max(last_killed, alive_trees[i - 1][0]):
		answer += 1
	elif alive_trees[i][0] + alive_trees[i][1] < alive_trees[i + 1][0]:
		answer += 1
		last_killed = alive_trees[i][0] + alive_trees[i][1]
print(answer)


x = int(input())
lt = []
n = 0
for i in range(x):
	lt.append([int(i) for i in input().split()])
for i in range(1, x - 1):
	(a, b) = lt[i]
	if a - b > lt[i - 1][0]:
		n += 1
	elif a + b < lt[i + 1][0]:
		n += 1
		lt[i][0] = a + b
print([n + 1, n + 2][x != 1])


n = int(input())
cord = []
h = []
for i in range(n):
	l = list(map(int, input().split()))
	cord.append([l[0], l[0]])
	h.append(l[1])
count = 0
for j in range(n):
	if j == 0:
		cord[j][0] = cord[j][0] - h[j]
		count = count + 1
	elif j == n - 1:
		cord[j][1] = cord[j][1] + h[j]
		count = count + 1
	elif cord[j][0] - h[j] > cord[j - 1][1]:
		cord[j][0] = cord[j][0] - h[j]
		count = count + 1
	elif cord[j][1] + h[j] < cord[j + 1][0]:
		cord[j][1] = cord[j][1] + h[j]
		count = count + 1
print(count)


n = int(input())
trees = [tuple(map(int, input().split())) for _ in range(n)]
r = 0
for i in range(n):
	if i == 0 or trees[i - 1][0] + trees[i][1] < trees[i][0]:
		r += 1
	elif i != n - 1 and trees[i][0] + trees[i][1] < trees[i + 1][0] or i == n - 1:
		trees[i] = (trees[i][0] + trees[i][1], 0)
		r += 1
print(r)


import sys

def main():
	n = int(sys.stdin.readline())
	x = []
	h = []
	for i in range(n):
		(xi, hi) = map(int, sys.stdin.readline().split(' '))
		x.append(xi)
		h.append(hi)
	seg = x[0]
	t = 1
	for i in range(1, n):
		if x[i] - h[i] > seg:
			seg = x[i]
			t += 1
		elif i == n - 1 or x[i] + h[i] < x[i + 1]:
			seg = x[i] + h[i]
			t += 1
		else:
			seg = x[i]
	return t
sys.stdout.write('{}\n'.format(main()))


from sys import stdin
input = iter(stdin.readlines()).__next__
n = int(input())
trees = [tuple(map(int, input().split())) for _ in range(n)]
if len(trees) == 1:
	count = 1
else:
	count = 2
	last_covered = trees[0][0]
	for (index, (pos, height)) in enumerate(trees[1:-1], start=1):
		if pos - height > last_covered:
			last_covered = pos
			count += 1
		elif pos + height < trees[index + 1][0]:
			last_covered = pos + height
			count += 1
		else:
			last_covered = pos
print(count)


value = input('')
n = int(value)
answer = 1
minTrees = 1
maxTrees = pow(10, 5)
if not minTrees <= n <= maxTrees:
	n = 1
lastX = 0
treesCut = 0
lastTree = ''
for key in range(0, n):
	newTree = input('')
	if n >= 3:
		if lastTree != '':
			argv = lastTree.split(' ')
			x = int(argv[0])
			h = int(argv[1])
			toLeft = x - h
			if toLeft > lastX:
				treesCut += 1
				lastX = x
			else:
				toRight = x + h
				nextTree = newTree.split(' ')
				nextTreeX = int(nextTree[0])
				if toRight < nextTreeX:
					treesCut += 1
					lastX = toRight
				else:
					lastX = x
			if key == n - 1:
				treesCut += 1
		else:
			argv = newTree.split(' ')
			x = int(argv[0])
			h = int(argv[1])
			lastX = x - h - 1
	lastTree = newTree
if n < 3:
	treesCut = n
print(treesCut)


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


import sys
n = int(sys.stdin.readline())
leftStart = int(sys.stdin.readline().split()[0])
ans = 1
points = []
if n > 1:
	for i in range(1, n):
		inp = str(sys.stdin.readline())[:-1].split()
		points.append(inp)
	ans += 1
	endPoint = int(inp[-1][0])
	leftPoint = leftStart
	for i in range(n - 2):
		x = int(points[i][0])
		h = int(points[i][1])
		tmpX = x - h
		if tmpX > leftPoint:
			ans += 1
			leftPoint = x
		else:
			tmpX = x + h
			if tmpX < int(points[i + 1][0]):
				leftPoint = tmpX
				ans += 1
			else:
				leftPoint = x
print(ans)


n = int(input())
l = [list(map(int, input().split())) for _ in range(n)]
if n == 1:
	print(1)
	exit()
ans = 2
for i in range(1, n - 1):
	(x, h) = (l[i][0], l[i][1])
	if x - h > l[i - 1][0]:
		ans += 1
		continue
	if x + h < l[i + 1][0]:
		ans += 1
		l[i][0] = x + h
print(ans)


c = int(input())
X = [float('-inf')]
H = [0]
for i in range(c):
	(x, h) = map(int, input().strip().split(' '))
	X.append(x)
	H.append(h)
X.append(float('inf'))
H.append(0)
cut = 2
for i in range(2, c):
	(px, ph) = (X[i - 1], H[i - 1])
	(nx, nh) = (X[i + 1], H[i + 1])
	(x, h) = (X[i], H[i])
	if h < x - px:
		cut += 1
	elif h < nx - x:
		X[i] += h
		cut += 1
if c < 2:
	print(c)
else:
	print(cut)


n = int(input())
L = [tuple(map(int, input().split())) for k in range(n)]
indI = L[0][0]
if n <= 2:
	print(n)
else:
	ac = 2
	for k in range(1, n - 1):
		izq = L[k][0] - L[k][1]
		der = L[k][0] + L[k][1]
		if izq > L[k - 1][0] and izq > indI:
			ac += 1
		elif der < L[k + 1][0]:
			ac += 1
			indI = der
	print(ac)


n = int(input())
d = [[0, 0] for i in range(n)]
for i in range(n):
	(d[i][0], d[i][1]) = list(map(int, input().split()))
(d[0][0], d[0][1]) = (d[0][0] - d[0][1], d[0][0])
count = 1
if n == 1:
	print(count)
else:
	d[-1][1] = d[-1][0] + d[-1][1]
	count += 1
	for i in range(1, n - 1):
		right = d[i][0] + d[i][1]
		left = d[i][0] - d[i][1]
		right_possible = 0
		left_possible = 0
		if right < d[i + 1][0]:
			right_possible = 1
		if left > d[i - 1][1]:
			left_possible = 1
		if left_possible == 0 and right_possible == 0:
			d[i][1] = d[i][0]
		elif left_possible:
			d[i][1] = d[i][0]
			d[i][0] = left
			count += 1
		else:
			d[i][1] = right
			count += 1
	print(count)


n = int(input())
arr = list(((0, 0) for _ in range(n))) + [(2000000000.0 + 3, 2000000000.0 + 3)]
for i in range(n):
	(a, b) = map(int, input().split())
	arr[i] = (a, b)
if n < 3:
	print(n)
	exit()
arr.sort()
(res, e) = (0, -2000000000.0)
for i in range(n):
	if arr[i][0] - arr[i][1] > e:
		res += 1
		e = arr[i][0]
	elif arr[i][0] + arr[i][1] < arr[i + 1][0]:
		res += 1
		e = arr[i][0] + arr[i][1]
	else:
		e = arr[i][0]
print(res)


import sys
import math
import collections
import bisect

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()
n = int(input())
pos = []
for i in range(n):
	co = get_list()
	pos.append(co)
pos.sort()
count = 0
i = 0
while i < n:
	if i == 0:
		count += 1
	elif i == n - 1:
		count += 1
	else:
		left = pos[i][0] - pos[i][1]
		right = pos[i][0] + pos[i][1]
		if left > pos[i - 1][0]:
			count += 1
		elif right < pos[i + 1][0]:
			pos[i][0] = right
			count += 1
	i += 1
print(count)


from sys import stdin
N = int(stdin.readline())
X = []
trees = {}
gaps = []
for n in range(N):
	line = stdin.readline().strip().split()
	X.append(int(line[0]))
	trees[int(line[0])] = int(line[1])
gaps = sorted([(X[i], X[i + 1]) for i in range(len(X) - 1)], key=lambda g: g[0])
trees[X[0]] = 0
trees[X[-1]] = 0
for i in range(1, len(X) - 1):
	if trees[X[i]] < X[i] - X[i - 1]:
		trees[X[i]] = 0
	elif trees[X[i]] < X[i + 1] - X[i]:
		X[i] += trees[X[i]]
		trees[X[i]] = 0
print(sum((trees[k] == 0 for k in trees)))


def knock(n, positions, heights):
	dp = [[0 for i in range(n)] for ja in range(3)]
	dp[0][0] = 1
	dp[1][0] = 0
	dp[2][0] = 0
	if n > 1 and positions[0] + heights[0] < positions[1] or n == 1:
		dp[2][0] = 1
	for i in range(1, n):
		if positions[i] - heights[i] > positions[i - 1]:
			if positions[i - 1] + heights[i - 1] < positions[i] - heights[i]:
				dp[0][i] = 1 + max(dp[0][i - 1], dp[1][i - 1], dp[2][i - 1])
			else:
				dp[0][i] = 1 + max(dp[0][i - 1], dp[1][i - 1])
		dp[1][i] = max(dp[0][i - 1], dp[1][i - 1], dp[2][i - 1])
		if i == n - 1 or positions[i] + heights[i] < positions[i + 1]:
			dp[2][i] = 1 + max(dp[0][i - 1], dp[1][i - 1], dp[2][i - 1])
	return max(dp[0][n - 1], dp[1][n - 1], dp[2][n - 1])
n = int(input())
p = []
h = []
for i in range(n):
	(x, y) = input().split()
	p.append(int(x))
	h.append(int(y))
print(knock(n, p, h))


def solve():
	n = int(input())
	trees = [0 for _ in range(n)]
	height = [0 for _ in range(n)]
	for i in range(n):
		(trees[i], height[i]) = map(int, input().rstrip().split())
	felled = 0
	for i in range(n):
		if i == 0:
			felled += 1
		elif i == n - 1:
			felled += 1
		elif trees[i - 1] + height[i] < trees[i]:
			felled += 1
		elif trees[i + 1] - height[i] > trees[i]:
			felled += 1
			trees[i] += height[i]
	print(felled)
solve()


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


l = []
n = int(input())
for _ in range(n):
	l.append(list(map(int, input().split())))
if n <= 2:
	print(n)
else:
	count = 2
	occupied = l[0][0]
	for i in range(1, n - 1):
		if l[i][0] - l[i - 1][0] > l[i][1] and l[i][0] - l[i][1] > occupied:
			count += 1
		elif l[i + 1][0] - l[i][0] > l[i][1]:
			count += 1
			occupied = l[i][0] + l[i][1]
	print(count)


n = int(input())
arr = []
for i in range(n):
	(x, h) = map(int, input().split())
	arr.append([x, h])
arr.append([1e+18, 0])
prev = -1e+18
ans = 0
for i in range(n):
	if arr[i][0] - arr[i][1] > prev:
		ans += 1
		prev = arr[i][0]
	elif arr[i][0] + arr[i][1] < arr[i + 1][0]:
		ans += 1
		prev = arr[i][0] + arr[i][1]
	else:
		prev = arr[i][0]
print(ans)


def main():
	(res, h1) = (0, -1)
	x1 = lo = -10 ** 9
	for _ in range(int(input())):
		(x2, h2) = map(int, input().split())
		if lo < x1 - h1:
			res += 1
		elif x1 + h1 < x2:
			res += 1
			x1 += h1
		(lo, x1, h1) = (x1, x2, h2)
	print(res)
main()


n = int(input())
inf = 2000000001
xs = [-inf]
hs = [1]
for i in range(n):
	(x, h) = map(int, input().split())
	xs.append(x)
	hs.append(h)
xs.append(inf)
hs.append(1)
sol = 0
last_cut_x = xs[0]
for i in range(1, len(xs) - 1):
	if xs[i] - hs[i] > xs[i - 1] and xs[i] - hs[i] > last_cut_x:
		sol += 1
	elif xs[i] + hs[i] < xs[i + 1]:
		sol += 1
		last_cut_x = xs[i] + hs[i]
print(sol)


import os
import sys
from io import BytesIO, IOBase
mod = 10 ** 9 + 7

def main():
	n = int(input())
	x = []
	h = []
	for _ in range(n):
		(a, b) = map(int, input().split())
		x.append(a)
		h.append(b)
	if n == 1:
		print(1)
		exit()
	elif n == 2:
		print(2)
		exit()
	ans = 2
	z = x[0]
	i = 1
	while True:
		if z < x[i] - h[i]:
			ans += 1
			z = x[i]
		elif z >= x[i] - h[i]:
			if x[i] + h[i] < x[i + 1]:
				ans += 1
				z = x[i] + h[i]
			else:
				z = x[i]
		i += 1
		if i == n - 1:
			break
	print(ans)

def nouse0():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse1():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse2():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def nouse3():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse4():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse5():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')
main()


n = int(input().strip())
ll = []
ii = []
for i in range(n):
	k = list(map(int, input().split()))
	ll.append(k[0])
	ii.append(k[1])
j = 1
l = ll[0]
for i in range(1, n - 1):
	if ll[i] - ii[i] > l:
		j += 1
		l = ll[i]
	elif ll[i] + ii[i] < ll[i + 1]:
		j += 1
		l = ll[i] + ii[i]
	else:
		l = ll[i]
if n > 1:
	j += 1
print(j)


n = int(input())
tree = []
for i in range(n):
	(x, h) = map(int, input().split())
	tree.append((x, h))
cut = 1
cordinate = tree[0][0]
for i in range(1, n - 1):
	thistree = tree[i]
	nexttree = tree[i + 1]
	if thistree[0] - thistree[1] > cordinate:
		cut += 1
		cordinate = thistree[0]
		continue
	if thistree[0] + thistree[1] < nexttree[0]:
		cut += 1
		cordinate = thistree[0] + thistree[1]
		continue
	cordinate = thistree[0]
if n == 1:
	print('1')
else:
	print(cut + 1)


fibonacci_cache = {}

def fibonacci(n):
	if n in fibonacci_cache:
		return fibonacci_cache[n]
	elif (n == 1) | (n == 2):
		return 1
	else:
		fibonacci_cache[n] = fibonacci(n - 1) + fibonacci(n - 2)
		return fibonacci_cache[n]

def check_tree(it):
	if (tree_x1[it] - tree_height[it] not in tree_x1) & (tree_x1[it] - tree_height[it] not in tree_x2) & (tree_x1[it] + tree_height[it] not in tree_x1) & (tree_x1[it] + tree_height[it] not in tree_x2):
		return 0
	elif ((tree_x1[it] + tree_height[it] in tree_x1) | (tree_x1[it] + tree_height[it] in tree_x2)) & ((tree_x1[it] - tree_height[it] not in tree_x1) & (tree_x1[it] - tree_height[it] not in tree_x2)):
		return 0
	elif ((tree_x1[it] - tree_height[it] in tree_x1) | (tree_x1[it] - tree_height[it] in tree_x2)) & ((tree_x1[it] + tree_height[it] not in tree_x1) & (tree_x1[it] + tree_height[it] not in tree_x2)):
		return 0
	else:
		return -1

def max_cuts(n_trees):
	if n_trees == 0:
		return 0
	elif check_tree[n_trees] != -9:
		q = -9999999
	for i in range(1, n_trees + 1):
		q = max(q, max_cuts(n_trees - 1) + 1)
	return q

def greedy_woodcut():
	counter = 1
	if int(n) >= 2:
		counter = 2
	for i in range(1, int(n) - 1):
		if tree_x1[i] - tree_x1[i - 1] > tree_height[i]:
			counter += 1
		elif tree_x1[i + 1] - tree_x1[i] > tree_height[i]:
			tree_x1[i] += tree_height[i]
			counter += 1
	return counter
n = input()
tree_x1 = list()
tree_height = list()
for i in range(0, int(n)):
	line = input()
	(x, h) = line.split()
	tree_x1.append(int(x))
	tree_height.append(int(h))
print(greedy_woodcut())


rows = int(input())
if rows == 1:
	print(1)
	exit()
lst = []
c = 2
for i in range(rows):
	lst.append(list(map(int, input().split())))
for i in range(1, rows - 1):
	if lst[i][0] - lst[i][1] > lst[i - 1][0]:
		c += 1
	elif sum(lst[i]) < lst[i + 1][0]:
		lst[i][0] = sum(lst[i])
		c += 1
print(c)


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
	elif 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())
count = min(n, 2)
p = [[0 for j in range(2)] for k in range(n)]
dis = []
for i in range(n):
	(x, h) = map(int, input().split())
	p[i][0] = x
	p[i][1] = h
for m in range(1, n):
	dis.append(p[m][0] - p[m - 1][0])
for g in range(n - 2):
	if p[g + 1][1] < dis[g]:
		dis[g] = dis[g] - p[g + 1][1]
		count += 1
	elif p[g + 1][1] < dis[g + 1]:
		dis[g + 1] = dis[g + 1] - p[g + 1][1]
		count += 1
print(count)


n = int(input())
a = []
b = []
for i in range(n):
	(x, h) = map(int, input().split())
	a.append(x)
	b.append(h)
if len(a) == 1:
	r = 1
else:
	r = 2
for i in range(1, len(a) - 1):
	if a[i] - b[i] > a[i - 1]:
		r += 1
	elif a[i] + b[i] < a[i + 1]:
		a[i] = a[i] + b[i]
		r += 1
print(r)


n = int(input())
co = []
h = []
for _ in range(n):
	(x, h2) = map(int, input().split())
	co.append(x)
	h.append(h2)
co.append(10 ** 10)
dp = [[0] * 3 for _ in range(n)]
dp[0][0] = 1
dp[0][1] = 1
dp[0][2] = 0
for i in range(1, n):
	if co[i] - h[i] > co[i - 1] + h[i - 1]:
		dp[i][0] = 1 + max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
	elif co[i] - h[i] > co[i - 1]:
		dp[i][0] = 1 + max(dp[i - 1][0], dp[i - 1][2])
	else:
		dp[i][0] = max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
	if co[i] > co[i - 1] + h[i - 1] and co[i] + h[i] < co[i + 1]:
		dp[i][1] = 1 + max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
	elif co[i] > co[i - 1] and co[i] + h[i] < co[i + 1]:
		dp[i][1] = 1 + max(dp[i - 1][0], dp[i - 1][2])
	else:
		dp[i][1] = max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
	dp[i][2] = max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
print(max(dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]))


import sys
import string
from collections import Counter, defaultdict
from math import fsum, sqrt, gcd, ceil, factorial
from itertools import combinations, permutations
flush = lambda : sys.stdout.flush
comb = lambda x, y: factorial(x) // factorial(y) // factorial(x - y)
ip = lambda : input()
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())
n = ii()
arr = [rr() for _ in range(n)]
ans = 2
for i in range(1, n - 1):
	if arr[i][0] - arr[i][1] > arr[i - 1][0]:
		ans += 1
	elif arr[i][0] + arr[i][1] < arr[i + 1][0]:
		ans += 1
		arr[i][0] += arr[i][1]
print(ans if n > 1 else 1)


n = input()
n = int(n)
x = []
ans = 1
if n == 1:
	print(ans)
else:
	for i in range(n):
		(xi, hi) = input().strip().split()
		xi = int(xi)
		hi = int(hi)
		x.append([xi, hi])
	for i in range(1, n - 1):
		if x[i][0] - x[i - 1][0] > x[i][1]:
			ans += 1
		elif x[i + 1][0] - x[i][0] > x[i][1]:
			x[i][0] = x[i][0] + x[i][1]
			ans += 1
	print(ans + 1)


n = int(input())
arr = []
for i in range(n):
	arr.append(list(map(int, input().split())))
arr.sort()
if n == 1:
	cnt = 1
else:
	cnt = 2
prev = arr[0][0]
for i in range(1, n - 1):
	if abs(arr[i][0] - prev) > arr[i][1]:
		prev = arr[i][0]
		cnt += 1
	elif abs(arr[i][0] - arr[i + 1][0]) > arr[i][1]:
		prev = arr[i][0] + arr[i][1]
		cnt += 1
	else:
		prev = arr[i][0]
print(cnt)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	a = [LI() for _ in range(n)] + [[inf, inf]]
	t = -inf
	r = 0
	for i in range(n):
		(x, h) = a[i]
		if x - h > t:
			r += 1
			t = x
			continue
		nx = a[i + 1][0]
		if x + h < nx:
			r += 1
			t = x + h
		else:
			t = x
	return r
print(main())


n = int(input())
(xold, hold) = map(int, input().split(' '))
k = 1
flag = True
for i in range(n - 1):
	(xnew, hnew) = map(int, input().split(' '))
	if flag == False:
		if xold + hold < xnew:
			k += 1
			xold = xold + hold
	if xold < xnew - hnew:
		k += 1
		flag = True
	else:
		flag = False
	(xold, hold) = (xnew, hnew)
if flag == False:
	k += 1
print(k)


n = int(input())
x = {}
for _ in range(n):
	(x1, h1) = map(int, input().split())
	x[x1] = h1
y = sorted(x)
ans = 1
z = y[0]
for i in range(1, n):
	if y[i] - x[y[i]] > z:
		z = y[i]
		ans += 1
	elif i + 1 < n:
		if y[i] + x[y[i]] < y[i + 1]:
			z = y[i] + x[y[i]]
			ans += 1
		else:
			z = y[i]
	else:
		ans += 1
print(ans)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nlargest, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
n = int(data())
dp = dd(lambda : dd(int))
mat = []
for i in range(n):
	mat.append(l())
if n <= 2:
	out(n)
	exit()
for i in range(n):
	if i == 0:
		dp[i]['left'] = 1
		dp[i]['not cut'] = 0
		dp[i]['right'] = 0
		if mat[0][0] + mat[0][1] < mat[1][0]:
			dp[i]['right'] = 1
		continue
	if mat[i][0] - mat[i][1] > mat[i - 1][0]:
		dp[i]['left'] = max(dp[i - 1]['left'], dp[i - 1]['not cut']) + 1
	if mat[i][0] - mat[i][1] > mat[i - 1][0] + mat[i - 1][1]:
		dp[i]['left'] = max(dp[i]['left'], dp[i - 1]['right'] + 1)
	dp[i]['not cut'] = max(dp[i - 1]['not cut'], dp[i - 1]['right'], dp[i - 1]['left'])
	if i == n - 1:
		dp[i]['right'] = max(dp[i - 1]['right'], dp[i - 1]['not cut'], dp[i - 1]['left']) + 1
		break
	if mat[i][0] + mat[i][1] < mat[i + 1][0]:
		dp[i]['right'] = max(dp[i - 1]['not cut'], dp[i - 1]['right'], dp[i - 1]['left']) + 1
out(max(dp[n - 1]['right'], dp[n - 1]['not cut'], dp[n - 1]['left']))


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


n = int(input())
data = [0] * n
for i in range(n):
	data[i] = list(map(int, input().split()))
count = 0
taken_space = 0
for j in range(n):
	if j == 0:
		count += 1
	elif j == n - 1:
		count += 1
	elif data[j][0] - data[j - 1][0] - taken_space > data[j][1]:
		count += 1
		taken_space = 0
	elif data[j + 1][0] - data[j][0] > data[j][1]:
		count += 1
		taken_space = data[j][1]
	else:
		taken_space = 0
print(count)


l = []
for item in range(int(input())):
	(f, h) = map(int, input().split())
	l.append((f, h))
lastOccupy = l[0][0]
count = [1, 2][len(l) > 1]
for (i, c) in enumerate(l[1:-1], 1):
	(x, h) = c
	if x - h > lastOccupy:
		lastOccupy = x
		count += 1
	elif x + h < l[i + 1][0]:
		lastOccupy = x + h
		count += 1
	else:
		lastOccupy = x
print(count)


from sys import *
input = stdin.readline
n = int(input())
t = []
for i in range(n):
	(a, b) = map(int, input().split())
	t.append([a, b])
if n == 1:
	c = 1
else:
	c = 2
for i in range(1, n - 1):
	l = t[i][0] - t[i - 1][0]
	r = t[i + 1][0] - t[i][0]
	h = t[i][1]
	if h < l:
		c += 1
	elif h < r:
		c += 1
		t[i][0] = t[i][0] + h
print(c)


a = 2
n = int(input())
l = []
for _ in range(n):
	(x, h) = map(int, input().split())
	l.append([x, h])
if n < 3:
	print(n)
	exit()
t = l[0][0]
for i in range(1, n - 1):
	(x, h) = (l[i][0], l[i][1])
	if x - h > t:
		a += 1
		t = x
	elif x + h < l[i + 1][0]:
		a += 1
		t = x + h
	else:
		t = x
print(a)


n = int(input())
pairs = [tuple((int(x) for x in input().split())) for _ in range(n)]
(ps, s) = (pairs[0][0], 2)
if len(pairs) == 1:
	print(1)
else:
	for i in range(1, n - 1):
		(xc, hc) = pairs[i]
		(xn, hn) = pairs[i + 1]
		if ps < xc - hc:
			ps = xc
			s += 1
		elif xc + hc < xn:
			ps = xc + hc
			s += 1
		else:
			ps = xc
	print(s)


n = int(input())
res = 1
ls = -9999999999
mat = []
sat = []
for i in range(n):
	(x, y) = map(int, input().split())
	mat.append(x)
	sat.append(y)
for j in range(n - 1):
	if mat[j] - ls > sat[j]:
		res += 1
		ls = mat[j]
	elif mat[j + 1] - mat[j] > sat[j]:
		res += 1
		ls = mat[j] + sat[j]
	else:
		ls = mat[j]
print(res)


n = int(input())
x = [0] * (n + 1)
h = [0] * (n + 1)
l = [0] * (n + 1)
r = [0] * (n + 1)
inf = 10 ** 10
for i in range(0, n):
	(x[i], h[i]) = map(int, input().split(' '))
x[n] = inf
l[0] = 1
if x[0] + h[0] < x[1]:
	r[0] = 1
for i in range(1, n):
	l[i] = max(l[i - 1], r[i - 1])
	r[i] = max(l[i - 1], r[i - 1])
	if x[i - 1] + h[i - 1] < x[i] - h[i]:
		l[i] = max(l[i], r[i - 1] + 1)
	if x[i] - h[i] > x[i - 1]:
		l[i] = max(l[i], l[i - 1] + 1)
	if x[i] + h[i] < x[i + 1]:
		r[i] = max(r[i], max(l[i - 1], r[i - 1]) + 1)
print(max(r[n - 1], l[n - 1]))


n = int(input())
coordinate = []
outcome = 2 if n >= 2 else 1
for _ in range(n):
	(x, h) = map(int, input().split())
	coordinate.append([x, h])
coordinate.sort(key=lambda y: y[0])
for i in range(1, n - 1):
	if coordinate[i][0] - coordinate[i - 1][0] > coordinate[i][1]:
		outcome += 1
	elif coordinate[i + 1][0] - coordinate[i][0] > coordinate[i][1]:
		outcome += 1
		coordinate[i][0] += coordinate[i][1]
print(outcome)


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())
x = [0] * n
h = [0] * n
dp = [0] * n

def task():
	global n, x, h, dp
	pos = 0
	for dx in range(n):
		if dx == n - 1:
			dp[dx] = dp[dx - 1] + 1
		else:
			dp[dx] = dp[dx - 1]
			if x[dx] - pos > h[dx] or dx == 0:
				dp[dx] += 1
				pos = x[dx]
			elif x[dx] + h[dx] < x[dx + 1]:
				dp[dx] += 1
				pos = x[dx] + h[dx]
			else:
				pos = x[dx]

def main():
	for i in range(n):
		global x, h
		(x[i], h[i]) = map(int, input().split(' '))
	task()
	print(dp[n - 1])
main()


n = int(input())
l = []
for i in range(n):
	l.append(list(map(int, input().split())))
l.sort()
if n < 2:
	print(1)
else:
	c = 2
	for i in range(1, n - 1):
		x = l[i][0] + l[i][1]
		y = l[i][0] - l[i][1]
		if y > l[i - 1][0]:
			c = c + 1
		elif x < l[i + 1][0]:
			c = c + 1
			l[i][0] = x
	print(c)


n = int(input())
(x1, h1) = map(int, input().split())
res = [[0, 0, 0] for i in range(n)]
res[0][0] = 1
from sys import stdin
for i in range(1, n):
	(x2, h2) = map(int, stdin.readline().split())
	if i == 1:
		if h1 < x2 - x1:
			res[0][1] = 1
	else:
		k = 0
		if h1 < x2 - x1:
			k = 1
		res[i - 1][1] = max(res[i - 2][0], res[i - 2][1], res[i - 2][2]) + k
	(q, w) = (0, 0)
	if h2 < x2 - x1:
		q = 1
	if h2 + h1 < x2 - x1:
		w = 1
	res[i][0] = max(res[i - 1][0] + q, res[i - 1][1] + w, res[i - 1][2] + q)
	res[i][2] = max(res[i - 1][0], res[i - 1][1], res[i - 1][2])
	(x1, h1) = (x2, h2)
if n > 1:
	res[n - 1][1] = max(res[n - 2][0], res[n - 2][1], res[n - 2][2]) + 1
print(max(res[n - 1]))


ans = 2
I = lambda : list(map(int, input().split()))
l = []
for tc in range(int(input())):
	(x, h) = map(int, input().split())
	l.append([x, h])
t = l[0][0]
n = len(l)
if n <= 2:
	print(n)
	exit()
for i in range(1, n - 1):
	(x, h) = l[i]
	if x - h > t:
		ans += 1
		t = x
	elif x + h < l[i + 1][0]:
		ans += 1
		t = x + h
	else:
		t = x
print(ans)


n = int(input())
A = []
for i in range(n):
	B = [int(x) for x in input().split()]
	A.append(B)
num = 1
pre = A[0][0]
for i in range(1, n - 1):
	a = A[i]
	b = A[i + 1]
	if a[0] - pre > a[1]:
		num += 1
		pre = a[0]
		continue
	if a[0] + a[1] < b[0]:
		num += 1
		pre = a[0] + a[1]
		continue
	pre = a[0]
if n == 1:
	print(1)
else:
	print(num + 1)


def cut(l):
	if len(l) <= 2:
		return len(l)
	count = 2
	prevEnd = l[0][0]
	for i in range(1, len(l) - 1):
		(x, h) = l[i]
		nextEnd = l[i + 1][0]
		if x - h > prevEnd:
			prevEnd = x
			count += 1
			continue
		if x + h < nextEnd:
			prevEnd = x + h
			count += 1
			continue
		prevEnd = x
	return count
n = int(input())
l = list()
for _ in range(n):
	l.append(tuple(map(int, input().split())))
print(cut(l))


import sys
inf = float('inf')
mod = 1000000007

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline()

def solve():
	dp[0][0] = 1
	dp[0][1] = 1 if n > 1 and position[0] + height[0] < position[1] else 0
	dp[0][2] = 1
	for i in range(1, n):
		dp[i][2] = max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2])
		dp[i][0] = dp[i - 1][0]
		if position[i] - height[i] > position[i - 1]:
			dp[i][0] = max(dp[i - 1][0], dp[i - 1][2]) + 1
		if position[i] - height[i] > position[i - 1] + height[i - 1]:
			dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + 1)
		if i < n - 1 and position[i] + height[i] >= position[i + 1]:
			continue
		dp[i][1] = max(dp[i - 1][0], dp[i - 1][1], dp[i - 1][2]) + 1
n = int(input())
position = [0] * n
height = [0] * n
for i in range(n):
	(position[i], height[i]) = get_ints()
dp = [[0] * 3 for _ in range(n)]
solve()
print(max(dp[-1][0], dp[-1][1], dp[-1][2]))


n = int(input())
final = []
for i in range(n):
	(p, h) = map(int, input().split())
	final.append([p, h])
if len(final) == 1:
	print(1)
else:
	count = 2
	for i in range(1, len(final) - 1):
		if final[i][0] - final[i][1] > final[i - 1][0]:
			count += 1
		elif final[i][0] + final[i][1] < final[i + 1][0]:
			count += 1
			final[i][0] += final[i][1]
	print(count)


n = int(input())
place = []
tree = []
for i in range(n):
	next = input().split()
	place.append(int(next[0]))
	tree.append(int(next[1]))
greedy = 1
occupied = False
index = 1
while index < n - 1:
	if not occupied and place[index - 1] + tree[index] < place[index]:
		greedy += 1
	elif occupied and place[index - 1] + tree[index - 1] + tree[index] < place[index]:
		greedy += 1
		occupied = False
	elif place[index] + tree[index] < place[index + 1]:
		greedy += 1
		occupied = True
	else:
		occupied = False
	index += 1
if n > 1:
	greedy += 1
print(greedy)


t = int(input())
l = [[int(x) for x in input().split()] for i in range(t)]
if t >= 3:
	count = 2
	end = l[0][0]
	begin = l[2][0]
	for i in range(1, t - 2):
		if l[i][0] - l[i][1] > end:
			count += 1
			end = l[i][0]
		elif l[i][0] + l[i][1] < begin:
			count += 1
			end = l[i][0] + l[i][1]
		else:
			end = l[i][0]
		begin = l[i + 2][0]
	if l[-2][0] - l[-2][1] > end or l[-2][0] + l[-2][1] < l[-1][0]:
		print(count + 1)
	else:
		print(count)
else:
	print(t)


from sys import stdin
n = int(stdin.readline())
if n == 1:
	print(1)
	exit()
(x, h) = ([], [])
for i in range(n):
	(a, b) = (int(t) for t in stdin.readline().split())
	x.append(a)
	h.append(b)
a = [-1] * n
b = [-1] * n
c = [-1] * n
a[0] = 1
b[0] = 0
if x[0] + h[0] < x[1]:
	c[0] = 1
else:
	c[0] = 0
for i in range(1, n):
	if x[i - 1] < x[i] - h[i]:
		a[i] = max(a[i - 1], b[i - 1]) + 1
	if x[i - 1] + h[i - 1] < x[i] - h[i]:
		a[i] = max(a[i], c[i - 1] + 1)
	b[i] = max(a[i - 1], b[i - 1], c[i - 1])
	c[i] = b[i]
	if i + 1 == n:
		c[i] += 1
	elif x[i] + h[i] < x[i + 1]:
		c[i] += 1
print(max(a[-1], b[-1], c[-1]))


n = int(input())
h = []
x = []
for i in range(n):
	(a, b) = map(int, input().split())
	x.append(a)
	h.append(b)
last = x[0]
t = 1
for i in range(1, n - 1):
	if last < x[i] - h[i]:
		t += 1
		last = x[i]
	elif x[i] + h[i] < x[i + 1]:
		t += 1
		last = x[i] + h[i]
	else:
		last = x[i]
if n > 1:
	t += 1
print(t)


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)


import sys
n = int(input())
a = []
for i in range(0, n):
	(x, h) = map(int, input().split())
	a.append([x, h])
lp = -10 ** 10
ans = 1
for i in range(0, n - 1):
	if a[i][0] - a[i][1] > lp:
		ans += 1
		lp = a[i][0] - a[i][1]
	elif a[i][0] + a[i][1] < a[i + 1][0]:
		ans += 1
		lp = a[i][0] + a[i][1]
	lp = max(lp, a[i][0])
print(ans)


n = int(input())
p = n
x = []
h = []
while p > 0:
	p = p - 1
	(a, b) = map(int, input().split())
	x.append(a)
	h.append(b)
c = 0
table = [0] * n
table[0] = -1
table[n - 1] = 1
for i in range(1, n - 1):
	if table[i - 1] == -1:
		if x[i] - x[i - 1] > h[i]:
			table[i] = -1
			c = c + 1
		elif x[i + 1] - x[i] > h[i]:
			table[i] = 1
			c = c + 1
	elif table[i - 1] == 0:
		if x[i] - x[i - 1] > h[i]:
			table[i] = -1
			c = c + 1
		elif x[i + 1] - x[i] > h[i]:
			c = c + 1
			table[i] = 1
	elif x[i] - x[i - 1] - h[i - 1] > h[i]:
		table[i] = -1
		c = c + 1
	elif x[i + 1] - x[i] > h[i]:
		table[i] = 1
		c = c + 1
if n < 2:
	print(1)
else:
	print(c + 2)


n = int(input())
l = []
for i in range(n):
	l.append(list(map(int, input().split())))
if n <= 2:
	print(n)
	exit()
else:
	ans = 2
	for i in range(1, n - 1):
		if l[i][0] - l[i][1] > l[i - 1][0]:
			ans += 1
		elif l[i][0] + l[i][1] < l[i + 1][0]:
			l[i][0] += l[i][1]
			ans += 1
		else:
			continue
	print(ans)


answer = 0
n = int(input())
T = [[-10 ** 10, 0]] + [[int(x) for x in input().split()] for i in range(n)] + [[10 ** 10, 0]]
for x in range(1, n + 1):
	if T[x][0] - T[x - 1][0] > T[x][1]:
		answer += 1
	elif T[x + 1][0] - T[x][0] > T[x][1]:
		answer += 1
		T[x][0] += T[x][1]
print(answer)


N = int(input())
x = []
h = []
for i in range(N):
	temp = input().split(' ')
	x.append(int(temp[0]))
	h.append(int(temp[1]))
if N <= 2:
	print(N)
else:
	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]
	print(ans)


import atexit
import io
import sys
_I_B = sys.stdin.read().splitlines()
input = iter(_I_B).__next__
_O_B = io.StringIO()
sys.stdout = _O_B

@atexit.register
def write():
	sys.__stdout__.write(_O_B.getvalue())

def main():
	xh = []
	n = int(input())
	for _ in range(n):
		xh.append(tuple(map(int, input().split())))
	_ = 0
	count = 0
	for (x, h) in xh:
		if _ == 0:
			lo = x
			count += 1
		elif _ == n - 1:
			count += 1
			break
		elif x - h > lo:
			lo = x
			count += 1
		elif x + h < xh[_ + 1][0]:
			lo = x + h
			count += 1
		else:
			lo = x
		_ += 1
	print(count)
main()


from sys import stdin, stdout
cin = stdin.readline
cout = stdout.write
n = int(cin())
a = []
for _ in range(n):
	a.append(list(map(int, cin().split())))
a.append([10 ** 10, 10 ** 10])
count = 1
x = a[0][0]
for i in range(1, n):
	if a[i][0] - a[i][1] > x:
		x = a[i][0]
		count += 1
	elif a[i][0] + a[i][1] < a[i + 1][0]:
		x = a[i][0] + a[i][1]
		count += 1
	else:
		x = a[i][0]
cout(str(count) + '\n')


n = int(input())
if n == 1:
	print(1)
else:
	tree = [[int(x) for x in input().split()] for y in range(n)]
	N = 2
	spot = tree[0][0]
	for i in range(1, n - 1):
		if tree[i][0] - spot > tree[i][1]:
			N += 1
			spot = tree[i][0]
		elif tree[i + 1][0] - tree[i][0] > tree[i][1]:
			N += 1
			spot = tree[i][0] + tree[i][1]
		else:
			spot = tree[i][0]
	print(N)


count = 0
a = []
b = []
n = int(input(''))
for i in range(n):
	(u, v) = map(int, input('').split(' '))
	a.append(u)
	b.append(v)
for j in range(1, n - 1):
	if a[j] - b[j] > a[j - 1]:
		count += 1
	elif a[j] + b[j] < a[j + 1]:
		count += 1
		a[j] = a[j] + b[j]
if n > 1:
	print(count + 2)
else:
	print(1)