peterverebics/CodeNet_Python_118 huggingface dataset:
N = int(input())

XL = []
for i in range(N):
    tmp = list(map(int, input().split()))
    XL.append(tmp)
    
XL = sorted(XL, key=lambda x:x[0])

i = 0
now = 0
count = 0
while i <= len(XL)-2:
    now_arm = XL[now][0] + XL[now][1]
    if now_arm > XL[i+1][0] - XL[i+1][1]:
        count += 1
    else:
        now = i
    i += 1    


#print(XL)
print(len(XL) - count)
from sys import stdin
N = int(stdin.readline().rstrip())
data = []
for i in range(N):
    X,L = [int(x) for x in stdin.readline().rstrip().split()]
    data.append((X-L,X+L))

ans = 0
left = -10**9-1
for j,k in sorted(data):
    if j >= left:
        left = k
        ans += 1
print(ans)
N=int(input())
rang=[]
for _ in range(N):
  x,l=map(int,input().split())
  rang.append((x-l, x+l))
rang=sorted(rang, key=lambda x: x[0])
lastright=rang[0][1]
cnt=1
for i in range(1,N):
  left=rang[i][0]
  right=rang[i][1]
  if left>=lastright:
    cnt+=1
    lastright=right
print(cnt)
from collections import defaultdict
n = int(input())
rob = defaultdict(list)
for i in range(n):
    x,l  = map(int,input().split())
    rob[x] = [l,x-l,x+l]
rob = sorted(rob.items())
print(rob)
ans = n
for idx,(key,[l,left,right]) in enumerate(rob):
    if idx != 0:
        if r > left:
            ans -= 1
        r = min(r,right)
    else:
        r = right

print(ans)
n = int(input())
x = []
for i in range(n):
    tmpx, tmpl = map(int,input().split())
    x.append((tmpx,tmpl))
x = sorted(x)
#print(x)
ans = n

flag = 1
for i in range(n-1):
    if (x[i][0]+x[i][1]>x[i+1][0] or x[i][0]+x[i][1]>x[i+1][0]-x[i+1][1]) and flag == 1:
        ans -= 1
        flag = 0
    elif x[i][0]+x[i][1]<=x[i+1][0] and flag == 0:
        flag = 1
print(ans)
N = int(input())

lob = []

for _ in range(N):
    X, L = map(int,input().split())
    lob.append([X + L - 1, X - L])

lob.sort()

ans = 0
last = 0
for l in lob:
    if last < l[1]:
        ans += 1
        last = l[0]

print(ans)
N=int(input())
import sys
l=[i.rstrip().split() for i in sys.stdin.readlines()]
l=[list(map(int,i)) for i in l]
l=[[i-j,i+j] for i,j in l]
from operator import itemgetter
l.sort(key=itemgetter(1))
ans=N
for i in range(N-1):
   end=l[i][1]
   if l[i+1][0] < end:
      ans-=1
   else:
      end=l[i+1][1]
print(ans)
N = int(input())
s = [list(map(int,input().split())) for i in range(N)]

removal_count = 0
for index, arm in enumerate(s):
  if index+1 == len(s):
    break
  if index >0:
    if arm[0]+arm[1]>s[index+1][0]-s[index+1][1] and arm[0]-arm[1] < s[index-1][0]+s[index+1][1]:
      s.remove(arm)
print(s)

for index, arm in enumerate(s):
  if index+1 == len(s):
    break
  if arm[0]+arm[1] > s[index+1][0]-s[index+1][1]:
    s.remove(arm)
  
print(len(s))
n=int(input())
xlis=sorted([list(map(int,input().split())) for i in range(n)])
counter=0
nlis=[]
rlis=[]
highest=-1000000000000
th=0
for i in range(n):
    high=xlis[i][0]+xlis[i][1]
    low=xlis[i][0]-xlis[i][1]
    nlis.append([low,high])
    rlis.append([low,high])
for i in range(n-2):
    if nlis[i][1]>=nlis[i+2][0]:
        rlis.remove(nlis[i])
for i in range(len(rlis)):
    if rlis[i][0]>=highest:
        counter+=1
        highest=rlis[i][1]
        th=0
print(counter)
N = int(input())
arm_x = {}
for _ in range(N):
    inp = list(map(int, input().split()))
    arm_x[inp[0]] = inp[1]
dic = sorted(arm_x.items(), key=lambda x:x[0])
ans = N
i = 0
while i <N:
    temp = 0
    for j in range(i+1,N):
        if dic[i][0]+dic[i][1]> dic[j][0]-dic[j][1]:
            ans -= 1
            temp += 1
        else:
            break
    i += 1+temp
print(ans)
# -*- coding: utf-8 -*-

N = int(input())
X = []

for i in range(N):
    tmp = list(map(int,input().split()))
    X.append((tmp[0],tmp[1]))

X.sort()
flag = []
cnt = 0
for i, t in enumerate(X):
    if i == 0:
        flag.append(1)
        continue
    if (X[cnt][0]+X[cnt][1] > t[0]-t[1]):
        flag.append(0)
    else:
        flag.append(1)
        cnt = i

print(sum(flag))
n=int(input())
xl=[list(map(int,input().split())) for _ in range(n)]
xl.sort(key=lambda x: x[0])
ans=1
nx=xl[0][0]
for i in range(1,n):
  x,l=xl[i]
  if nx<x-l:
    ans+=1
    nx=x
print(ans)
import math
def main():
    N = int(input())
    robo = []
    for _ in range(N):
        x, l = map(int, input().split())
        robo.append((x+l-1, x-l+1))
    robo = sorted(robo, key = lambda x:x[0])

    ans = 0
    t = -100000000000000000000000000000000000000000000000000000000
    for i in range(N):
        if t < robo[i][1]:
            ans += 1
            t = robo[i][0]

    print(ans)




    return 0

if __name__ == '__main__':
    main()
N = int(input())

robo = []
for _ in range(N):
    X, L = map(int, input().split())
    robo.append([X-L, X+L])

robo = sorted(robo, key=lambda x:x[1])

last = robo[0][1]
cnt = 1
for r in robo[1:]:
    if r[0] >= last:
        cnt += 1
        last = r[0]

print(cnt)
n = int(input())
X = []
for i in range(n):
    x, y = map(int, input().split())
    X.append((x - y + 1, x + y))
X.sort()
ter = 0
cnt = 0
for left, right in X:
    if ter < left:
        ter = right
        cnt += 1
print(cnt)
if __name__ == "__main__":
    n = int(input())
    robot = list()
    for i in range(n):
        robot.append(list(map(int, input().split())))

    robot.sort()

    ans = 0
    arm_pos = -10**9 - -1
    for r in robot:
        if r[0] - r[1] >= arm_pos:
            ans += 1
            arm_pos = r[0] + r[1]

    print(ans)
N = int(input())

L = [[int(x) for x in input().split()] for x in range(N)]

S = []
for i in range(len(L)):
    S.append(sorted([L[i][0] - L[i][1],L[i][0] + L[i][1]]))
    #L[i][0] = L[i][0] - L[i][1]
    #L[i][1] = L[i][0] + L[i][1]
Q =sorted(S)

a = 0
check = Q[0][1]
for i in range(1,len(Q)):
    if check <= Q[i][0] :
        check = Q[i][1]
    else:
        a += 1

print(N-a)
N = int(input())
XL = [tuple(map(int, input().split())) for i in range(N)]
XL.sort(key=lambda x: x[0])

right = -10**9
removed = 0
for x, l in XL:
    if x-l < right:
        removed += 1
    else:
        right = x+l
print(N-removed)
INF = 2 * (10 ** 9) - 1

n = int(input())
xl = [[0] * 2 for i in range(n)]
for i in range(n) :
    x, l = map(int, input().split())
    xl[i][0] = x-l+1
    xl[i][1] = x+l-1

xl.sort(key=lambda x:x[1])

cnt = 0
#print(xl)
cur = -10 ** 10
ans = 0

for i in range(n) :
    if cur < xl[i][0] :
        #print(i)
        ans += 1
        cur = xl[i][1]
        #prinst(xl[i])


print(ans)
n=int(input())
lis=[]
for _  in range(n):
    x,l=map(int,input().split())
    lis.append([x-l,x+l])

lis.sort(key=lambda x:x[0])
count = 0
tmp = - 10 ** 18
for i in lis:
    if tmp <= i[0]:
        count += 1
        tmp = i[1]

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

XL.sort()

result = 1
x, l = XL[0]
r = x + l
for i in range(1, N):
    x, l = XL[i]
    if r <= x - l:
        result += 1
        r = x + l
print(result)
from operator import itemgetter

N = int(input())
XL = sorted([list(map(int, input().split())) for _ in range(N)], key=itemgetter(0, 1))

res = 0
i = 0
while i < N:
    if i + 1 < N and sum(XL[i]) > XL[i + 1][0] - XL[i + 1][1]:
        if sum(XL[i]) < XL[i + 1][0] + XL[i + 1][1]:
            res += 1
        i += 1
    else:
        res += 1
    i += 1

print(res)
import sys
from operator import itemgetter

n = int(input())
robots = []
for line in sys.stdin:
    X, L = map(int, line.split())
    l, r = X - L, X + L
    robots.append((l, r))
robots.sort(key=itemgetter(1))

curr = -1
ans = 0
for l, r in robots:
    if curr > l:
        continue
    ans += 1
    curr = r
print(ans)
import math
N=int(input())
ES = []
for i in range(N):
    x,l = list(map(int,input().split()))
    ES.append((min(x+l-1,10**9),max(x-l+1,0)))

ES = sorted(ES)
# print(ES)

sel = []
cur = None
for E,S in ES:
    if cur is None or cur < S:
        sel.append((E,S))
        cur = E
# print(sel)
print(len(sel))
N = int(input())
Lpos = []
INF = 10 ** 9 + 7
for i in range(N):
    Lpos.append(list(map(int, input().split())))
Lpos.sort(key=lambda x: x[0])
Lpos.sort(key=lambda x: x[1])

endpos = -INF
cnt = 0
for i in range(N):
    if Lpos[i][0] > endpos:
        cnt += 1
        endpos = Lpos[i][0] + Lpos[i][1]
print(cnt)
n = int(input())
xs = []
scope = {}
for _ in range(n):
    x, l = map(int, input().split())
    xs.append(x)
    scope[x] = [x-l, x+l]
    
xs.sort()
ans = n
end = scope[xs[0]][1]
for i in xs[1:]:
    start = scope[i][0]
    if end > start:
        ans -= 1
        end = start
print(ans)
def main():
    import sys

    readline = sys.stdin.readline

    N = int(readline())
    XL = [list(map(int, readline().split())) for _ in [0] * N]
    arm = [(x + length, x - length) for x, length in XL]
    arm.sort()
    time, ans = 0, 0
    for i in range(N):
        end, start = arm[i]
        if time <= start:
            ans += 1
            time = end
    print(ans)


main()
def LR(x,l):
  return (x-l,x+l)
def overlap(a,b):
  return a[1]>b[0]

if __name__=='__main__':
    N=int(input())
    XL=[]
    for i in range(N):
        xl=input().split()
        XL += [LR(int(xl[0]),int(xl[1]))]
    XL=sorted(XL,key=lambda x:x[0])
    result=[XL[0]]
    for i in range(1,N):
       last=result[-1]
       if not overlap(last,XL[i]):
          result+=[XL[i]]
    print(len(result))
N = int(input())
X = [0]*N
L = [0]*N
d = {}
max = 0
del_count = 0
first = 0
for i in range(N):

  x,l= map(int,list(input().split()))
  if i == 0:
    first = x
  d[x] = l
s = sorted(d.items())
new_list = sorted(X)
for x,l in s:
  if first == x:
    max = x + l
  elif max > x - l:
    del_count +=1
  else:
    max = x + l
print(N-del_count)
n = int(input())
xl = []
for i in range(n):
    xl.append(list(map(int,input().split())))
xl.sort()
#print(xl)
s = xl[0][0] + xl[0][1]
ans = 1
for i in range(1,n):
    nxt = xl[i][0] - xl[i][1]
 #   print(s,nxt)
    if s <= nxt:
        s = xl[i][0] + xl[i][1]
        ans += 1
print(ans)
n=int(input())
points = []
for _ in range(n):
  X,L = map(int,input().split())
  points.append([X+L, X -L])
points.sort(key = lambda x: x[0])
cur = -10*9
answer = 0
for point in points:
  if point[1] >= cur:
    answer += 1
    cur = point[0]
print(answer)
def solve():
    N = int(input())
    X = []
    for i in range(N):
        xx, ll = map(int, input().split())
        X.append((xx-ll, xx+ll))
    X.sort()
    count = 0
    cur = -(10**9)
    for i in range(N):
        c, d = X[i]
        if cur <= c:
            count += 1
            cur = d
    return count

print(solve())
N = int(input())
XL = []
for n in range(N):
    XL.append([int(x) for x in input().split()])
XL = sorted(XL, key=lambda x:(x[0],x[0]+x[1]))
m = -float("inf")
ans = 0
for n in range(N):
    if XL[n][0]-XL[n][1] >= m:
        ans += 1
        m = XL[n][0]+XL[n][1]
print(ans)
N = int(input())
L = []

L = [[int(x) for x in input().split()] for x in range(N)]

S = []
for i in range(len(L)):
    S.append(sorted([L[i][0] - L[i][1],L[i][0] + L[i][1]]))
    #L[i][0] = L[i][0] - L[i][1]
    #L[i][1] = L[i][0] + L[i][1]
Q =sorted(S)
a = 1
check = max(Q[0])
print(Q)
for i in range(0,len(Q)-1):
    if min(Q[i+1]) >=check :
        check = min(Q[i+1])
        a+=1
    else:
        check = max(Q[i+1])
print(a)
# Keyence 2020 B
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
n=ni()
l=[]
for i in range(n):
    a,b=nm()
    l.append([a+b,a-b])
l.sort(key=lambda x:x[0])

cur=-10*9
ans=0
for i in range(n):
    if l[i][1]>=cur:
        ans+=1
        cur=l[i][0]
print(ans)
N = int(input())

arm = {}
for i in range(N):
    X, L = map(int, input().split())
    arm[X - L] = X + L

arm = sorted(arm.items(), key=lambda x: x[1])

count = 0
i = arm[0][0]
for item in arm:
    if item[0] >= i:
        i = item[1]
        count += 1

print(count)
N=int(input())
A=[[0]*2 for i in range(N)]
for i in range(N):
    A[i][0],A[i][1]=map(int,input().split())
A=sorted(A)
ans=[]
ans.append(A[0])
for i in range(1,len(A)):
    if (ans[-1][0]+ans[-1][1])<=(A[i][0]-A[i][1]):
        ans.append(A[i])
print(len(ans))
H = int(input())

_list = []

for i in range(H):
  set = input().split(" ")
  _list.append([int(set[0]) - int(set[1]), int(set[0]) + int(set[1])])

new_list = sorted(_list, key=lambda x: x[1])

ans_list = [new_list[0]]
for i in new_list:
  if i[0] > ans_list[-1][1]:
    ans_list.append(i)
print(len(ans_list))
N = int(input())
XL = [list(map(int, input().split())) for _ in range(N)]

XL.sort()

result1 = 1
x, l = XL[0]
r = x + l
for i in range(1, N):
    x, l = XL[i]
    if r <= x - l:
        result1 += 1
        r = x + l

result2 = 0
r = -(10 ** 9)
for i in range(1, N):
    x, l = XL[i]
    if r <= x - l:
        result2 += 1
        r = x + l

print(max(result1, result2))
N = int(input())

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

S = []
for i in range(len(L)):
    S.append(sorted([L[i][0] - L[i][1],L[i][0] + L[i][1]]))
    #L[i][0] = L[i][0] - L[i][1]
    #L[i][1] = L[i][0] + L[i][1]
Q =sorted(S)

a = 0
check = Q[0][1]
for i in range(1,N):
    if check <= Q[i][0] :
        check = Q[i][1]
    else:
        a += 1

print(N-a)
n = int(input())
dic = {}
lim = -10*9
for _ in range(n):
  x,l = map(int,input().split())
  dic[l+x] = x
dic = sorted(dic.items())
a = 0
lim = -10*9
for i in dic:
  if lim>i[0]-2*(i[0]-i[1]):
    continue
  else:
    a += 1
    lim = i[0]
print(a)
n = int(input())
s = [list(map(int, input().split())) for _ in [0] * n]

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

c = 0
for i in range(10):
    i = 0
    while (i != len(s)-1 and i < len(s)):
        if s[i][1] >= abs(s[i][0] - s[i+1][0]):
            c += 1
            s.pop(i)
        i += 1


print(n-c)
n = int(input())
xls = [list(map(int, input().split()))for i in range(n)]
xls.sort(key=lambda x:x[0])
ans = 1
x, l = xls[0]
for i in range(1, n):
    nx, nl = xls[i]
    if nx-nl+1<x+l: continue
    ans += 1
    x, l = nx, nl
print(ans)
N = int(input())

dic = {}
for n in range(N):
    x, l = map(int, input().split())
    d = {x:l}
    dic.update(d)

ran = []
re = dic
for d in list(dic):
    if ran != []:
        if (ran[0]<d-dic[d]<ran[1]) or (ran[0]<d+dic[d]<ran[1]):
            re.pop(d)
            ran = []
    else:
        ran.append(d-dic[d])
        ran.append(d+dic[d])

print(len(re))
n = int(input())
x_l=[]

for i in range(n):
	x, l = map(int, input().split())
	a = x - l + 1
	b = x + l - 1
	is_kaburi=False
	for y in range(int(len(x_l)/2)):
		a_2 = x_l[(y*2)]
		b_2 = x_l[(y*2)+1]
		if a_2 <= a and b_2 >= a:
			is_kaburi=True
			break
		if a_2 <= b and b_2 >= b:
			is_kaburi=True
			break
	if is_kaburi == False:
		x_l.append(a)
		x_l.append(b)

if len(x_l)!=0:
	print(int(len(x_l)/2))
else:
	print(0)
import numpy as np
N=int(input())
x={}
y={}
for i in range(N):
    x[i],y[i] = map(int, input().split())

Red = N

for i in range(N-1):
    before = x[i] + y[i]
    after  = x[i+1] + y[i+1]

    if (after < before):
        Red -= 1

print(Red)
n=int(input())
xl=[list(map(int, input().split())) for _ in range(n)]

rl=[]
for x,l in xl:
    right=x-l
    left=x+l
    rl.append([right,left])
rl.sort(key=lambda x: x[1],reverse=True)
# print(rl)

cnt=0
pos=float('inf')
for i in range(n):
    if rl[i][1]<=pos:
        pos=rl[i][0]
        cnt+=1
print(cnt)
n=int(input())
lr=[]
for i in range(n):
  x,l=map(int,input().split())
  lr.append((x-l,x+1))
lr.sort(key=lambda x: x[1])
ans=0
l=-10**18
r=0
for i in range(n):
  if i==0:
    tl,tr=lr[i]
    l=tl
    r=tr
    ans+=1
    continue
  tl,tr=lr[i]
  if tl>=r:
    ans+=1
    r=tr
    l=tl
print(ans)
from operator import itemgetter

N = int(input())
arms = []
for i in range(N):
    xl = [int(i) for i in  input().split()]
    xl[1] -= 1
    arms.append([xl[0] - xl[1], xl[0] + xl[1]])
arms = sorted(arms, key=itemgetter(1))
rm = 0
prev_arm = 0
for i in range(1, N):
    if arms[prev_arm][0] > arms[i][1] or arms[prev_arm][1] < arms[i][0]:
        prev_arm = i
    else:
        rm += 1
print(N - rm)
n=int(input())
A=[[] for i in range(n)]
for i in range(n):
    x,l=map(int,input().split())
    A[i]=[x-l,x+l]
A=sorted(A, key=lambda x :x[1])

last=0
ans=0
for i in range(n):
    if last<=A[i][0]:
        ans+=1
        last=A[i][1]

print(ans)
N = int(input())
robots = []
for _ in range(N):
    x, l = map(int, input().split())
    robots.append((x, l))

robots = sorted(robots, key=lambda x: x[0])
# print(robots)
leftest_point = robots[0][0] + robots[0][1]

ans = 0
for i in range(1, N):
    if robots[i][0]-robots[i][1] < leftest_point:
        ans += 1
        continue
    else:
        leftest_point = robots[i][0]+robots[i][1]

print(N-ans)
n=int(input())
a=[]
for i in range(n):
    x,l=map(int,input().split())
    a.append([x,l])
a=sorted(a,key=lambda x: x[1])
ans=n
t=a[0][1]
for i in range(1,n):
    if t>a[i][0]:
        ans-=1
    else:
        t=a[i][1]
print(ans)
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 12 07:49:36 2020

@author: naoki
"""
N = int(input())
xl = [list(map(int, input().split())) for _ in range(N)]

left_right = [[row[0]-row[1], row[0]+row[1]] for row in xl]
left_right = sorted(left_right, key = lambda x:int(x[1]))
count = 0
now = -10000
for row in (left_right):
    if row[0] < now:
        continue
    else:
        count += 1
        now = row[1]
print(count)
N=int(input())
ES = []
for i in range(N):
    x,l = list(map(int,input().split()))
    ES.append((x+l,x-l))

ES = sorted(ES)

sel = []
cur = None
ans = 0
for E,S in ES:
    if cur is None or cur <= S:
        sel.append((S,E))
        cur = E
print(ans)
from operator import itemgetter

n = int(input())
xl = sorted([[int(i) for i in input().split()] for i in range(n)],key=itemgetter(0))

hani = []
for t in xl:
    x,l = t
    hani.append([x-l,x+l])

ans = n
l,r = 0,1
while r < n and l < n:
    #print(hani[l][0],hani[l][1],hani[r][0],hani[r][1])
    if hani[r][0] < hani[l][1]:
        r += 1
        ans -= 1
    else:
        l = r
        r += 1
    #print(l,r)
print(ans)
n = int(input())
xl = [tuple(map(int,input().split())) for _ in range(n)]
xl.sort(key = lambda x:x[0]+x[1],reverse = True)
mini = xl[0][0]+xl[0][1]
ans = n
for i in range(n):
  if mini < xl[i][0]+xl[i][1]:
    ans -= 1
  else:
    mini = min(xl[i][0]-xl[i][1],mini)
    
print(ans)
N=int(input())
cnt=1
R=[[0]*2 for _ in range(N)]
for i in range(N):
  x,l=map(int,input().split())
  R[i][0]=(x-l+1)
  R[i][1]=(x+l-1)
R.sort()
for i in range(1,N):
  if R[i][0]>R[i-1][1]:
    cnt+=1
print(cnt)
from collections import deque
from sys import stdin
input = stdin.readline


def main():
  N = int(input())
  X_L = [tuple(map(int, input().split())) for _ in range(N)]
  # print(N)

  X_L.sort(key=lambda x: x[0])
  # print(X_L)

  added = [0]
  for i in range(1, N):
    pre = added[-1]
    if X_L[pre][0] + X_L[pre][1] <= X_L[i][0] - X_L[i][1]:
      added.append(i)
  print(len(added))


if(__name__ == '__main__'):
  main()
n = int(input())

xl = [[int(i) for i in input().split()] for j in range(n)]

xl= sorted(xl, key = lambda x:(x[0],x[1]))

now = xl[0][0] + xl[0][1]
count = 1

if(n == 1):
    print(1)
else:
    for i in range(1, n):
        if(now <= xl[i][0] - xl[i][1]):
            count += 1
            now = xl[i][0] + xl[i][1]

    print(count)
N = int(input())
R = []

for _ in range(N):
    x, l = map(int, input().split())
    s = x - l + 1
    l = x + l - 1
    R.append((s, l))
    
R.sort(key = lambda r:r[0])

cnt = 1
p = R[0][1]

for r in R[1:]:
    if p < r[0]:
        cnt += 1
        p = r[1]

print(cnt)
n = int(input())
L = []
for i in range(n):
    a,b = map(int,input().split())
    L.append([a-b,a+b])
L.sort()

cnt = 0
for i in range(n-1):
    if L[i][1] > L[i+1][0]:
        cnt +=1
        L[i],L[i+1] = L[i+1],L[i]
        #L.appendleft([-10**10,-10**10])
print(n-cnt)
N = int(input())
XL = [tuple(map(int, input().split())) for i in range(N)]

XL.sort(key=lambda x: x[0])

li = [XL[0]]

ans = 1
for i in range(1, N):
    if li[-1][0] + li[-1][1] > XL[i][0] - XL[i][1]:
        continue
    else:
        ans += 1

print(ans)
s=int(input())
t=[list(map(int, input().split())) for i in range(s)]
t.sort()
d=-10*10
ans=0
for i in range(s):
  a=t[i][0]-t[i][1]
  if d<a:
    ans+=1
    d=a+2*t[i][1]-1
print(ans)
n = int(input())
a = [list(map(int,input().split())) for i in range(n)]
a = [[a[i][0]-a[i][1],a[i][0]+a[i][1]] for i in range(n)]
a.sort(key = lambda x:x[1])
ans = 1
g = a[0][1]
for i in range(1,n):
  x = a[i][0]
  if g>=x:
    ans += 1
    g = a[i][1]
print(ans)
n = int(input())
a = sorted([list(map(int, input().split())) for _ in range(n)])
r = a[0][0]+a[0][1]-1
l = 0
for j in range(1,n):
    i = a[j]
    l = i[0]-i[1]+1
    #print(l,r)
    if r < l:
        r = i[0]+i[1]-1
    else:
        n -= 1
print(n)
a = int(input())
fanwei = []

for i in range(a):
    one = input().split()
    one = [int(i) for i in one]
    two = [one[0] - one[1], one[0] + one[1]]
    fanwei.append(two)

fanwei = sorted(fanwei, key=lambda student: 100000000000000000000 * (1 + student[0]) + student[1])

now = -100000000000000000000
ans = 0
for i in fanwei:
    down = i[0]
    if down >= now:
        ans += 1
        now = i[1]

print(ans)
N = int(input())

xl =[]
for i in range(0,N):
  x, l = map(int, input().split())
  xl.append((x-l,x+l))

xl = sorted(xl)
max_cover=0
num_remove = 0
for i,t in enumerate(xl[1:]):
    if t[0] < max_cover:
        num_remove += 1
    else:
        max_cover = t[1]

print(N-num_remove)
n=int(input())
x=[]
l=[]
w=[]
max=-(10**10)
num=0
for i in range(n):
    X,L=map(int,input().split())
    x.append(X)
    l.append(L)
    w.append(X-L)
    w.append(X+L)
for i in range(len(w)):
    if (w[i]<max) and i%2==0:
        num+=1
    elif (w[i]<max) and i%2==1:
        num+=0
    else:
        max=w[i]
print(len(w)-num)
length = int(input())
target = []
for i in range(length):
    s, e = map(int, input().split(" "))
    target.append([s, s + e])
target.sort(key = lambda x: x[0], reverse =  True)
target.sort(key = lambda x: x[1])
answer = 0
before_s, before_e = -1, -1
# print(target)
for s, e in target:
    # print(before_s, before_e, s, e)
    if before_s <= s < before_e or before_s < e <= before_e or s <= before_e < e:
        # print(1, before_s, before_e, s, e)
        answer += 1
    else:
        before_s = s
        before_e = e
print(length - answer)
from collections import defaultdict
n = int(input())
r = []
for i in range(n):
    x, l = map(int, input().split())
    r.append((x - l + 1, x + l - 1))
r.sort()
am = [[] for _ in range(n)]
for i in range(n):
    for j in range(i + 1, n):
        if r[i][1] < r[j][0]:
            break
        am[i].append(j)
        am[j].append(i)
print(am)
N=int(input())
XL=[list(map(int,input().split())) for i in range(N)]
XL.sort(key=lambda x:x[0])
inf=10**9+1
nin=-inf
ans=0
for i in range(N):
    X=XL[i][0]
    L=XL[i][1]
    if X-L<nin:
        ans+=1
    else:
        nin=X+L

print(N-ans)
N = int(input())
L = []

L = [[int(x) for x in input().split()] for x in range(N)]

S = []
for i in range(len(L)):
    S.append(sorted([L[i][0] - L[i][1],L[i][0] + L[i][1]]))
    #L[i][0] = L[i][0] - L[i][1]
    #L[i][1] = L[i][0] + L[i][1]
Q =sorted(S)
print(Q)
a = 1
check = max(Q[0])
for i in range(0,len(Q)-1):
    if min(Q[i+1]) >=check :
        check = min(Q[i+1])
        a+=1

print(a)
N = int(input())
alllist = []
remain = 0
for i in range(N):
    X, L = map(int,input().split())
    numberlist = []
    for j in range(X-L,X+L):
        if j in alllist:
            remainad = 0
            numberlist = []
            break
        
        else:
            remainad = 1
            numberlist.append(j)
    remain += remainad
    for p in range(len(numberlist)):
        alllist.append(p)
print(remain)
N = int(input())
arr = [list(map(int,input().split())) for i in range(N)]
arr = sorted(arr, key=lambda x: x[0])
F = [True]*N
P = [0]*N
for i in range(N):
  P[i] = [arr[i][0]-arr[i][1], arr[i][0]+arr[i][1]]
P = sorted(P,key=lambda x:x[1])
ind = 0
for i in range(1,N):
  if P[i][0] < P[ind][1]:
    F[i] = False
  else:
    ind += 1
print(F.count(True))
def m():
    N = int(input())
    XL = [list(map(int, input().split())) for _ in range(N)]
    ST = [[xl[0] - (xl[1] - 1), xl[0] + (xl[1] - 1)] for xl in XL]
    ST.sort(key=lambda x: x[1])
    ans = 1
    right = ST[0][1]
    for i in range(1, N):
        if right < ST[i][0]:
            right = ST[i][1]
            ans += 1
    return ans


print(m())