peterverebics/CodeNet_Python_118 huggingface dataset:
def main():
    n=int(input())
    xs=[0]*n
    ls=[0]*n
    ranges=[0]*n
    for i in range(n):
        xs[i],ls[i]=map(int,input().split())
        ranges[i]=[xs[i]-ls[i],xs[i]+ls[i]]
    ranges.sort(key=lambda x:x[1])
    count=0
    point=-1000000000000
    for irange in ranges:
        if irange[0]>=point:
            count+=1
            point=irange[1]
    print(count)
if __name__ == "__main__":
    main()
n = int(input())
table = []
for _ in range(n):
    x, l = map(int, input().split())
    table.append([x-l, x+l])

sorted_table = sorted(table, key=lambda x: x[1])
# print(sorted_table)
left = sorted_table[0][1]
ans = n
for i in range(1, n):
    if left <= sorted_table[i][0]:
        left = sorted_table[i][1]
    else:
        ans -= 1

print(ans)
N = int(input())
X1 = []

for i in range(N):
    X, L = map(int, input().split())
    X1.append([X+L, X-L])
X1.sort()
ans = -10**10
cnt = 0
for j in range(N):
    if(X1[j][1] >= ans):
        cnt += 1
        ans = X1[j][0]
print(cnt)
N = int(input())
XL = [list(map(int, input().split())) for _ in range(N)]

LR = [(x - l, x + l) for x, l in XL]
LR.sort(key = lambda x: x[1])
#print(LR)

right = LR[0][1]
answer = 1

for i in range(1, N):
  if right <= LR[i][0]:
    right = LR[i][1]
    answer += 1
print(answer)
n = int(input())
x = []
l = []
c = []
d = {}
 
for i in range(n):
    xx,ll = map(int, input().split())
    x.append(xx)
    l.append(ll)
    d[xx] = ll
 
 
dct = sorted(d.items())
 
f = 0
ans = 0
f = dct[0][0] + dct[0][1]
for i in range(1,len(dct)):
    if f > dct[i][0] - dct[i][1]:
        ans += 1
        f = min(f,dct[i][0]+dct[i][1])
    else:
        f = dct[i][0]+dct[i][1]
 
 
print(n-ans)
N = int(input())
robot = []
for _ in range(N):
  r = []
  x, l = map(int, input().split())
  a = x + l
  b = x - l
  r += [a, b]
  robot.append(r)
Robot = sorted(robot)
 
robot_count = [Robot[0]]
for i in range(1, N):
  if Robot[i][1] >= robot_count[-1][0]:
    robot_count.append(Robot[i])
 
print(len(robot_count))
N = int(input())
robots = []
for _ in range(N):
    x, dis = map(int, input().split())
    robots.append([x-dis,x+dis])
    
robots = sorted(robots, key=lambda x: x[1])
    
cnt = 0
now = -float("inf")
for left, right in robots:
    if left >= now:
        cnt += 1
        now = right
        
print(cnt)
length = int(input())
target = []
for i in range(length):
    s, e = map(int, input().split(" "))
    target.append([s - e, s + e])
target.sort(key = lambda x: x[1])
answer = 0
before_e = -float("inf")
for s, e in target:
    # print(before_e, s, e)
    if s < before_e:
        answer += 1
    else:
        before_e = e
print(length - answer)
n = int(input())
robots = []
for i in range(n):
    x, l = map(int, input().split())
    robots.append([max(x-l, 0), x+l])

robots.sort(key=lambda robot: robot[1])

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

print(ans)
def resolve():
    N = int(input())

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

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

    cnt = 0
    pre = -(1 << 60)
    for (l, r) in P:
        if pre > l:
            continue
        cnt += 1
        pre = r

    print(cnt)


if __name__ == "__main__":
    resolve()
def main():
    n = int(input())
    robot = [None]*n
    for i in range(n):
        x, arm = map(int, input().split())
        robot[i] = [x - arm, x + arm]
    robot.sort(key=lambda x: x[1])
    ans = 0
    x = -1 * (10)**9
    for i in range(n):
        if x <= robot[i][0]:
            ans += 1
            x = robot[i][1]
    print(ans)

if __name__ == "__main__":
    main()
n = int(input())
xl = [list(map(int, input().split())) for _ in range(n)]

distances = sorted([[x + l, x - l] for x, l in xl])

ans = 0
t = -float('inf')
for i in range(len(distances)):
    if t <= distances[i][1]:
        ans += 1
        t = distances[i][0]

print(ans)
a=int(input())
b=[list(map(int,input().split())) for i in range(a)]
c=[[i[0]-i[1],i[0]+i[1]] for i in b]
c.sort(key=lambda x: x[1])
ans=0
right=-10**9-1
for i in range(a):
    if right<=c[i][0]:
        ans+=1
        right=c[i][1]
print(ans)
n=int(input())
d=sorted([list(map(int,input().split()))for i in range(n)],key=lambda x:x[0]+x[1])
c=-float("INF")
an=0
for i,j in d:
    if i-j>=c:
        an+=1
        c=i+j
print(an)
N = int(input())
arms = []

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

arms.sort()

trash_count = 0
focus_point = 0

focus_point = arms[0][1]
for arm in arms[1:]:
    if focus_point <= arm[0]:
        focus_point = arm[1]
    elif focus_point <= arm[1]:
        trash_count += 1
    else:
        trash_count += 1
        focus_point = arm[1]

print(N-trash_count)
n=int(input())
a=[[int(i) for i in input().split()]for i in range(n)]
b=[]
for i in a:
    b.append([i[0]-i[1],i[0]+i[1]])

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

i=1
finish=c[0][1]
cnt=1
while i<n:
    if c[i][0]>=finish:
        finish=c[i][1]
        cnt+=1
    i+=1
print(cnt)
if __name__ == '__main__':
    n = int(input())
    robots = []
    for i in range(n):
        x, l = map(int, input().split())
        robots.append((x - l, x + l))
    robots = sorted(robots, key=lambda x: x[1])
    ans = []
    for i in range(n):
        if i == 0:
            ans.append(robots[i][1])
        else:
            if robots[i][0] >= ans[-1]:
                ans.append(robots[i][1])
    print(len(ans))
N=int(input())
XL=[]
for i in range(N):
    X,L=[int(x) for x in input().rstrip().split()]
    XL.append([X-L,X+L])
XL=sorted(XL,key=lambda x:x[1])


cnt=0
prev=-float('inf')
for l,r in XL:
    if prev<=l:
        prev=r
        cnt+=1
print(cnt)
from operator import itemgetter

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

x=[]
for i in range(n):
    x.append((s[i][0]-s[i][1],s[i][0]+s[i][1]))

x=sorted(x,key=itemgetter(1))
ans=1
r=x[0][1]
for i in range(1,n):
    if r<=x[i][0]:
        ans+=1
        r=x[i][1]

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

for _ in range(n):
    x, l = map(int, input().split())
    spans.append((x-l, x+l))
spans = sorted(spans, key=lambda x:x[1])

ans = 0
cur_end_time = -float("inf")

for st, en in spans:
    if cur_end_time > st:
        continue
    ans += 1
    cur_end_time = en
print(ans)
n = int(input())
s = [None] * n
for i in range(n):
    x, l = map(int, input().split())
    s[i] = x-l, x+l

s.sort(key=lambda x: x[1])
ans, c = 0, -float("inf")

for l, r in s:
    if c > l: continue
    ans += 1
    c = 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])
#XL.sort()

ans1=0
r=-10**9-1
for X,L in XL:
    if X-L>=r:
        ans1+=1
        r=X+L
ans2=0
l=-10**9+1
for X,L in reversed(XL):
    if X+L<=l:
        ans2+=1
        l=X-L

print(max(ans1,ans2))
MAX_V = 10**9

N = int(input())
TS = []
for i in range(N):
    X, L = map(int, input().split())
    TS.append((X + L, X - L))
TS = sorted(TS)
cur = -MAX_V
ans = 0
for i in range(N):
    if cur <= TS[i][1]:
        ans += 1
        cur = TS[i][0]
print(ans)
N = int(input())
rob = []
for i in range(N):
    X, L = map(int, input().split())
    rob.append([X-L, X+L])
rob.sort(key=lambda x: x[1])
ans = N
for i in range(N-1):
    if rob[i+1][0] < rob[i][1]:
        rob[i+1][1] = rob[i][1]
        ans -= 1
print(ans)
N = int(input())
R = []
for _ in range(N):
    x, l = map(int, input().split())
    R.append([x-l, x+l])

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

ans = 0
tmp = -float('inf')
for l, r in R:
    if tmp <= l:
        ans += 1
        tmp = r
print(ans)
n = int(input())
xl = []
for _ in range(n):
    x, l = map(int,input().split())
    xl.append((x-l, x+l, x, l))
xl.sort()

count = n
flag = 0
for i in range(n-1):
    if flag == 1: # this machine was removed.
        flag = 0
    else:
        left, right, x, l = xl[i]
    if xl[i+1][0] < right: # overlap
        if xl[i+1][1] <= right: # i includes i+1
            count -= 1 # remove i
        else:
            flag = 1
            count -= 1 # remove i+1

print(count)
N = int(input())
rm = 0
r = -float('inf')
robot = sorted([list(map(int, input().split())) for i in range(N)], key=lambda x: x[0] + x[1])

for x, l in robot:
    if x - l < r:
        rm += 1
    else:
        r = max(r, x + l)

print(N - rm)
N = int(input())

s_p, e_p = [0] * N, [0] * N
for i in range(N):
    X, L = map(int, input().split())
    s_p[i] = X - L
    e_p[i] = X + L

# sort by end point
c = sorted(zip(e_p, s_p))
e_p, s_p = zip(*c)

# greedy
e = -float('inf')
count = 0
for i in range(N):
    if s_p[i] >= e:
        count += 1
        e = e_p[i]
print(count)
n = int(input())
lis=[]
for _ in range(n):
    x,l = map(int,input().split())
    lis.append([x+l,x-l])

lis.sort()

m = -(10**9+7)
ans = 0

for i in range(n):
    a ,b = lis[i]
    if m <= b:
        ans += 1
        m = a
    
print(ans)
N=int(input())

robot=[]
for _ in range(N):
    x,l=map(int,input().split())
    robot.append((x+l,x-l))
robot.sort()

tmp=-10**10
ans=0
for i in range(N):
    end,start=robot[i]
    if tmp<=start:
        tmp=end
        ans+=1
print(ans)
n = int(input())
robots = []
for _ in range(n):
    x, l = map(int, input().split())
    robots.append([x-l, x+l])

robots = sorted(robots, key=lambda x: x[1])
robots.append([-2*10**9, 2*10**9])

cnt = 1
current_end = robots[0][1]
for i in range(1, n):
    if current_end <= robots[i][0]:
        cnt += 1
        current_end = robots[i][1]

print(cnt)
#区間スケジューリング問題

N = int(input())

robots = {}

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

    robots[X] = (X-L, X+L)

#終端が早い順にソートして、取れるものから貪欲法でとっていく

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

ans = 1
current_robot = robots_sorted[0]

for i in range(0, N):
    if current_robot[1][1] > robots_sorted[i][1][0]:
        continue

    ans += 1
    current_robot = robots_sorted[i]


print(ans)
N = int(input())
lst = []
for i in range(N):
    a, b = map(int, input().split())
    lst.append([a+b, a-b])
lst.sort()

cnt = 1
x = lst[0][0]
for i in lst:
    if x <= i[1]:
        cnt += 1
        x = i[0]

print(cnt)
n = int(input())
L = [[0, 0] for _ in range(n)]
for i in range(n):
  x, l = map(int, input().split())
  L[i][1] = x -l
  L[i][0] = x + l
  
L.sort()

ans = 0
for i in range(n):
  if i == 0:
    temp = L[i][0]
    ans += 1
  else:
    if L[i][1] >= temp:
      ans += 1
      temp = L[i][0]
    else:
      continue
print(ans)
n = int(input())
ll = []
for i in range(n):
  x, l = map(int, input().split())
  ll.append([x-l, x+l])
ll.sort(key=lambda x:x[1])

ans = 0
tmp = -10**9

for l in ll:
  if l[0] >= tmp:
    ans += 1
    tmp = l[1]

print(ans)
n = int(input())
XL = []
for i in range(n):
  x, l = map(int, input().split())
  XL.append([x, l])
  
XL.sort(key=lambda x: x[0]+x[1])

seen = -10**10
ans = 0
for i in range(n):
  rob = XL[i]
  if seen <= rob[0]-rob[1]:
    seen = rob[0]+rob[1]
    ans += 1

print(ans)
N = int(input())
arm = []
for n in range(N):
    i, L = map(int, input().split())
    arm.append([i+L, i-L])
sarm = sorted(arm)
pre = -10**10
count = 0
for a in sarm:
    if pre <= a[1]:
        count += 1
        pre = a[0]
print(count)
#!/usr/bin/env python3

N = int(input().split()[0])
xlt_list = []

for _ in range(N):
    x, l = list(map(int, input().split()))
    xlt_list.append((x, l, x + l))

xlt_list = sorted(xlt_list, key=lambda x: x[2])
count = 0
before_t = -float("inf")
for i, xlt in enumerate(xlt_list):
    x, l, t = xlt
    if x - l >= before_t:
        count += 1
        before_t = t

ans = count
print(ans)
import sys
input = sys.stdin.readline
n=int(input())
xl=[list(map(int,input().split())) for i in range(n)]
ab=[]
for i in range(n):
    x=xl[i][0]
    l=xl[i][1]
    a=x-l
    b=x+l
    ab.append([a,b])
ab.sort(key=lambda x:x[1])
B=-float("inf")
cnt=0
for i in range(n):
    a=ab[i][0]
    b=ab[i][1]
    if a>=B:
        cnt+=1
        B=b
print(cnt)
N = int(input())
A = [list(map(int,input().split())) for _ in range(N)]
B = sorted([(A[i][0]-A[i][1],A[i][0]+A[i][1]) for i in range(N)],key=lambda x:x[0],reverse=True)
B = sorted(B,key=lambda x:x[1])
cnt = 1
cur = B[0][1]
for i in range(1,N):
    if B[i][0]>=cur:
        cnt += 1
        cur = B[i][1]
print(cnt)
n = int(input())
x = [0]*n
l = [0]*n
for i in range(n):
    x[i] , l[i] = map(int, input().split())
itv = [[0 for i in range(2)] for j in range(n)]
for i in range(n):
    a = x[i]+l[i]
    b = x[i]-l[i]
    itv[i][0] = a
    itv[i][1] = b
itv.sort()

ans = 0
curx = -10000000000

for i in range(n):
    if curx <= itv[i][1]:
        curx = itv[i][0]
        ans += 1
        
print(ans)
n=int(input())
l=sorted([list(map(int,input().split())) for i in range(n)],key=lambda x:x[0]-x[1],reverse=1)
now=float("INF")
ans=0
for i in l:
    if sum(i)<=now:
        now=i[0]-i[1]
        ans+=1
print(ans)
n = int(input())
li = [list(map(int,input().split())) for _ in range(n)]

li2 = []
for i in range(n):
    li2.append([li[i][0]-li[i][1],li[i][0]+li[i][1]])

li2.sort()

nw = li2[0][1]
ans = 1
for i in range(1,n):
    if li2[i][0] >= nw:
        ans += 1
        nw = li2[i][1]
    elif li2[i][1] < nw:
        nw = li2[i][1]


print(ans)
n = int(input())
robot = []
for i in range(n):
    pos, arm = map(int, input().split())
    robot.append([pos-arm, pos+arm])
robot.sort(key=lambda x: x[1])
ans =[robot[0]]
for i in range(1, n):
    if ans[-1][1] <= robot[i][0]:
        ans.append(robot[i])
print(len(ans))
N=int(input())
XL=[list(map(int,input().split())) for i in range(N)]

R=[]
for i in range(N):
    a=max(0,XL[i][0]-XL[i][1])
    b=XL[i][1]+XL[i][0]
    R.append([b,a])
R.sort()

ans=0
con_l=0
for i in range(N):
    if con_l <= R[i][1]:
        ans += 1
        con_l = R[i][0]
print(ans)
n = int(input())

t = []
for i in range(n):
   x,l = map(int,input().split())
   t.append((x+l,x-l))
t.sort()
max_r = -float('inf')
ans = 0
for i in range(n):
    if max_r<=t[i][1]:
        ans+=1
        max_r=t[i][0]
print(ans)
n = int(input())
xl = [list(map(int, input().split())) for _ in range(n)]

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

lr.sort(key=lambda a: a[1])

cnt = 1
left, right = lr[0]
for ll, rr in lr:
    if ll >= right:
        cnt += 1
        left = ll
        right = rr

print(cnt)
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 = i
print(F.count(True))
n = int(input())
R = []

for i in range(n):
    xi,li = map(int, input().split( ))
    R.append((xi+li,xi-li,i))
#左から貪欲
R.sort()
ans = 0
right = -10**10
for i in range(n):
    if R[i][1]>=right:
        ans+=1
        right = R[i][0]

print(ans)
n = int(input())

s = [list(map(int,input().split())) for i in range(n)]
s.sort()

stop = s[0][0] + s[0][1]
ans = 1
for i in range(1,n):
    num = s[i][0]
    l = s[i][1]
    if num - l >= stop:
        ans += 1
        stop = num + l
    if num + l < stop:
        stop = num + l
    

print(ans)
n = int(input())
ls = []
for i in range(n):
    x,l = map(int,input().split())
    ls.append([x-l,l+x])
    
r = n
ls = sorted(ls, key=lambda item: item[1])
for i in range(1,n):
    if ls[i][0] < ls[i-1][1]:
      ls[i][1] = ls[i-1][1]
      r -=1
        
print(r)
N = int(input())

f = []
for i in range(N):
    x, l = map(int, input().split())
    f.append([x - l, x + l])
f.sort(key=lambda x: x[1])

t = f[0][1]
ans = 1
for i in range(1, N):
    if f[i][0] < t:
        continue
    ans += 1
    t = f[i][1]
print(ans)
n = int(input())
itv = []
for i in range(n):
    x,l = map(int, input().split())
    start = x - l if x - l > 0 else 0
    end = x + l
    itv.append([end, start])

itv.sort()

ans, t = 0, 0
for [x, l] in itv:
    if t <= l:
        ans += 1
        t = x

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

rnl = [(X + L, L - X) for X, L in XL]
rnl.sort()

ans = 0
cur_max = -float("inf")

for r, nl in rnl:
    l = -nl
    if l >= cur_max:
        ans += 1
        cur_max = r

print(ans)
N = int(input())
robots = {}
for _ in range(N):
    pos,armlen = map(int,input().split())
    robots[pos] = armlen

robots = sorted(robots.items(),key=lambda x:x[0])
range_min = robots[0][0] + robots[0][1]
ans = 1
for robot in robots[1:]:
    pos,armlen = robot
    if range_min <= (pos-armlen):
        ans += 1
        range_min = pos+armlen
    else:
        if range_min > (pos+armlen):
            range_min = pos+armlen

print(ans)
N=int(input())
P=[(0,0) for i in range(N)]
for i in range(N):
    x,l=map(int,input().split())
    P[i]=(x-l,x+l)
P.sort(key=lambda y:y[1])
#print(P)
ans=1
t=P[0][1]
for i in range(1,N):
    if t<=P[i][0]:
        ans+=1
        t=P[i][1]
print(ans)
n=int(input())
a=[]
for i in range(n):
    x,l=map(int,input().split())
    a.append([x-l,x+l])
a.sort(key=lambda x:x[1])
r=-10**10
ans=0
for i in range(n):
    if a[i][0]>=r:
        ans+=1
        r=a[i][1]
print(ans)
N = int(input())
XL = []
for i in range(N):
    array = list(map(int, input().strip().split()))
    XL.append(array)
XL = sorted(XL)
Y = 0
cnt = 0
for i in range(N):
    if max(XL[i][0]-XL[i][1],0)>=Y:
        cnt += 1
        Y = XL[i][0]+XL[i][1]
    else:
        Y = min(Y,XL[i][0]+XL[i][1])
print(cnt)
import numpy as np

N=int(input())
XL=[]
for i in range(N):
    XL.append(list(map(int,list(input().split()))))
XL=np.asarray(XL)
XLs=XL[np.argsort(XL[:,0])]
right=XLs[0][0]+XLs[0][1]
ans=1
for i in range(N-1):
    if right-(XLs[i+1][0]+XLs[i+1][1])>0:
        right=XLs[i+1][0]+XLs[i+1][1]
    elif XLs[i+1][0]-XLs[i+1][1]-right>=0:
        ans+=1
        right=XLs[i+1][0]+XLs[i+1][1]
print(ans)
_, *d = [list(map(int, s.split())) for s in open(0)]

d = sorted(d)
dd = []
for x, l in d:
    dd.append([x-l, x+l])

max_ = dd[0][0]
n = 0
for r, l in dd:
    if max_ <= r:
        n += 1
        max_ = l
    elif max_ > l:
        max_ = l
print(n)
#python3
import operator as op
n = int(input())
a = []
for _ in range(n):
    x, l = map(int, input().split())
    a.append((x - l, x + l))


a.sort(key=op.itemgetter(1))

tmp = - int(1e12)
cnt = 0
for i in range(n):
    MIN, MAX = a[i]
    if tmp > MIN:
        pass
    else:
        cnt +=1
        tmp = MAX
print(cnt)
N = int(input())
X, L = [], []
for _ in range(N):
    tmp_x, tmp_l = map(int, input().split())
    X.append(tmp_x)
    L.append(tmp_l)

end = [[X[i], L[i], X[i] + L[i]] for i in range(N)]
end = sorted(end, key = lambda x: x[2])

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

print(ans)
N=int(input())
XL=[list(map(int,input().split())) for i in range(N)]
XL.sort(key=lambda x:x[0]+x[1])
ans=1
left=XL[0][0]+XL[0][1]
for i in range(1,N):
  if XL[i][0]-XL[i][1] >= left:
    ans+=1
    left=XL[i][0]+XL[i][1]
  else:
    pass
print(ans)
N = int(input())
a = []
for i in range(N):
	X, L = map(int, input().split())
	a.append((X + L, X - L))
a.sort()
b = [a[0][0]]
i = 1
while i < N:
	if b[len(b) - 1] <= a[i][1]:
		b.append(a[i][0])
	i += 1
print(len(b))
N = int(input())
XL = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x:x[0]+x[1])
last = XL[0][0]-XL[0][1]
cnt = 0
for i in range(N):
    if last<=XL[i][0]-XL[i][1]:
        last = XL[i][0]+XL[i][1]
        cnt+=1
print(cnt)
n = int(input())
lis=[]
count=0
for i in range(n):
    li=[None]*2
    x, l = map(int, input().split())
    li[0] = x+l
    li[1] = x-l
    lis.append(li)
lis.sort()
kari_r = -(10 ** 18)
for r, l in lis:
        if kari_r > l:
            continue
        count+=1
        kari_r = r
            
print(count)
N = int(input())
D = []
for i in range(N):
    x, l = map(int, input().split())
    D.append([x-l, x+l])
from operator import itemgetter
D = sorted(D, key = itemgetter(1))
u = -10**10 #最小値:x = 0, l = 10**10の時
cnt = 0
for a, b in D:
    if u <= a:
       cnt += 1
       u = b #つぎのロボットの範囲の下限に置きかえる
print(cnt)
from operator import itemgetter


def solve():
    N = int(input())
    XL = [[] for _ in range(N)]
    for i in range(N):
        XL[i] = list(map(int, input().split()))
    
    XL.sort(key=itemgetter(0))
    ans = N
    r = sum(XL[0])
    for i in range(1, N):
        if XL[i][0] - XL[i][1] < r:
            ans -= 1
            r = min(r, sum(XL[i]))
        else:
            r = sum(XL[i])
    print(ans)


if __name__ == '__main__':
    solve()
N = int(input())
XL =[list(map(int, input().split())) for _ in range(N)]
LR = [[XL[i][0] - XL[i][1], XL[i][0] + XL[i][1]] for i in range(N)]
LR.sort(key = lambda x: x[1])

cp = LR[0][1]

ans = 0

for i in range(1,N):
	if LR[i][0] < cp:
		ans += 1
	else:
		cp = LR[i][1]
print(N-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
end=l[0][1]
for i in range(N-1):
   if l[i+1][0] < end:
      ans-=1
   else:
      end=l[i+1][1]
print(ans)
N = int(input())
A = []
for _ in range(N):
    X, L = map(int, input().split())
    A.append((X-L, X+L))

A = sorted(A, key=lambda x:x[1])
p = -10**10
ans = 0
for l, r in A:
    if l>=p:
        ans += 1
        p = r
print(ans)
n = int(input())
ra = []
for i in range(n):
    x,l = map(int,input().split())
    ra.append([x-l,x+l])

ra.sort(key = lambda x:x[0])
ans = 1
t = ra[0][1]
for i in range(n):
    if ra[i][0] >= t:
        ans += 1
        t = ra[i][1]
    else:
        t = min(t,ra[i][1])

print(ans)
import numpy as np

N = int(input())
X = np.zeros([N,4], dtype=int)

for i in range(N):
    X[i,0], X[i,1] = map(int, input().split())
    X[i,2], X[i,3] = X[i,0] - X[i,1], X[i,0] + X[i,1]    

col_num = 3
X = X[np.argsort(X[:, col_num])]
cnt = 1
r_min = X[0,3]
for i in range(1,N):
    if X[i,2] >= r_min:
        cnt += 1
        r_min = X[i,3]
print(cnt)
n=int(input())
lst=[list(map(int,input().split())) for i in range(n)]
lst=[[i[0]-i[1],i[0]+i[1]] for i in lst]

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

pin=lst[0][1]
ans=1

for i in range(1,n):
  if pin<=lst[i][0]:
    ans+=1
    pin=lst[i][1]

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

last_right = arms[0][1]
ans = 1
for i in range(1, n):
    left, right = arms[i]
    if left < last_right:
        continue
    last_right = right
    ans += 1

print(ans)
n=int(input())

selist=[]
for i in range(n):
    tmpx,tmpl = map(int,input().split())
    selist.append([tmpx-tmpl,tmpx+tmpl])

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


maeindex=0
maeza=selist[0][0]-1
robnum=0
finishflag=True



while finishflag:
	for i in range(maeindex,n):
		if selist[i][0] >= maeza:
			maeindex=i
			robnum+=1
			maeza=selist[i][1]
			break
		if i == n-1:
			finishflag=False


print(robnum)
N = int(input())

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

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


count = 0
max_arm_position_now = -int(1e10)
for i in range(N):
    min_arm_position_next = arms_range_list[i][0]
    if min_arm_position_next >= max_arm_position_now:
        max_arm_position_now = arms_range_list[i][1]
        count += 1


print(count)
n = int(input())
xl = [list(map(int, input().split())) for _ in range(n)]
ran = [[xl[i][0]-xl[i][1], xl[i][0]+xl[i][1]] for i in range(n)]
ran = sorted(ran, key=lambda x:x[1])
ans = 1
right = ran[0][1]
for i in range(n):
  l, r = ran[i]
  if l >= right:
    ans += 1 
    right = r 

print(ans)
n=int(input())
Y=[list(map(int,input().split())) for i in range(n)]
range=[]
ans,end=0,-1*(10**9+1)
for X in Y:
  range.append([X[0]-X[1],X[0]+X[1]])
range.sort(key=lambda X: X[1])

for R in range:
  if end <= R[0]:
    ans += 1
    end=R[1]
  else:
    continue
print(ans)