CodeEff/ECCO huggingface dataset:
# Original solution
def main():
    """
    2 <=  N <= 10^3
    2 <= ai <= 10^5

    非負整数 m に対して
    f(m) = (m mod a1) + (m mod a2) + (m mod aN)
    f_max

    mの制約は問題文中には直接記述されていない
    """
    N = int(input())
    *A, = map(int, input().split())

    ans = f(N, A)
    print(ans)


def f(N, A):
    """
    直感: 最小公倍数,最大公約数
        最小公倍数のm ならすべてのaで割り切れる
        つまり最小公倍数-1 ならすべてのaについて m mod ai = ai - 1

    m=a_MAX-1, (m mod a_MAX) が最大
    ただし他のa=a_MAX-1 の場合、f(m)は小さくなってしまう
    aiに対して1 <= m <= a_Max-1 をすべて試す: 10^5 * 3 * 10^3 => TLE
    """
    try:
        # py3.5
        from math import gcd
    except:
        from fractions import gcd

    def lcm(x, y):
        return x * y // gcd(x, y)

    m1 = lcm(A[0], A[1])
    for a in A[2:]:
        m1 = lcm(m1, a)

    m = m1 - 1
    ans = sum(m % a for a in A)

    return ans


def WA(N, A):
    ans = 0
    m_max = max(A) * 2 - 1
    for m in range(1, m_max):
        mods = [m % a for a in A]
        tmp = sum(mods)
        print(*(mods + [tmp]), sep="\t")
        ans = max(ans, tmp)

    return ans


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    """
    2 <=  N <= 10^3
    2 <= ai <= 10^5

    非負整数 m に対して
    f(m) = (m mod a1) + (m mod a2) + (m mod aN)
    f_max

    mの制約は問題文中には直接記述されていない
    """
    N = int(input())
    *A, = map(int, input().split())

    ans = editorial(N, A)
    print(ans)


def f(N, A):
    """
    直感: 最小公倍数,最大公約数
        最小公倍数のm ならすべてのaで割り切れる
        つまり最小公倍数-1 ならすべてのaについて m mod ai = ai - 1

    m=a_MAX-1, (m mod a_MAX) が最大
    ただし他のa=a_MAX-1 の場合、f(m)は小さくなってしまう
    aiに対して1 <= m <= a_Max-1 をすべて試す: 10^5 * 3 * 10^3 => TLE
    """
    try:
        # py3.5
        from math import gcd
    except:
        from fractions import gcd

    def lcm(x, y):
        return x * y // gcd(x, y)

    m1 = lcm(A[0], A[1])
    for a in A[2:]:
        m1 = lcm(m1, a)

    m = m1 - 1
    ans = sum(m % a for a in A)

    return ans


def editorial(N, A):
    """
    lcm を求めなくても、ai - 1 であることはわかるので
    lcm を計算しなくてよい
    """
    return sum(a - 1 for a in A)


def WA(N, A):
    ans = 0
    m_max = max(A) * 2 - 1
    for m in range(1, m_max):
        mods = [m % a for a in A]
        tmp = sum(mods)
        print(*(mods + [tmp]), sep="\t")
        ans = max(ans, tmp)

    return ans


if __name__ == '__main__':
    main()
# Original solution
import math

n = int(eval(input()))
a = list(map(int, input().split()))
common_num = 1
for num in a:
    common_num = (common_num * num) // math.gcd(common_num, num)
total = 0
for num in a:
    total += (common_num - 1) % num
print(total)


# Optimized solution
# 合計が最大になるのは、余りが各aにおいてa-1となるとき。
n = int(eval(input()))
a = list(map(int, input().split()))
# 各aから1ずつ引くをn繰り返しているため。
ans = sum(a) - n
print(ans)
# Original solution
def gcd(a, b):
    return a if b == 0 else gcd(b, a % b)


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


N = int(eval(input()))
A = list(map(int, input().split()))

l = 0
for i in range(1, len(A)):
    l = lcm(A[i - 1], A[i])
ans = l - 1
ans = sum(A) - len(A)
print(ans)


# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
ans = sum(A) - len(A)
print(ans)
# Original solution
n = int(eval(input()))
A = sorted(list(map(int,input().split())))
print((sum([n-1 for n in A])))

# Optimized solution
n = int(eval(input()))
print((sum(map(int,input().split()))-n))
# Original solution
N=int(eval(input()))
A=list(map(int,input().split()))
all=0
for i in range(N):
  all+=A[i]
print((all-N))

# Optimized solution
N=int(eval(input()))
A=list(map(int,input().split()))
all=sum(A)
print((all-N))
# Original solution
def gcd(i,j):
    a=max(i,j)
    b=min(i,j)
    if a%b==0:
        return b
    else:
        return gcd(b,a%b)
def lcm(i,j):
    return i*j//gcd(i,j)
N=int(eval(input()))
A=list(map(int,input().split()))
l=lcm(A[0],A[1])
for i in range(2,N):
    l=lcm(l,A[i])
ans=0
for i in A:
    ans+=(l-1)%i
print(ans)


# Optimized solution
N=int(eval(input()))
A=list(map(int,input().split()))
print((sum(A)-N))
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
m = 1

for i in range(n):
    m = m*a[i]

m -= 1

for i in range(n):
    ans += m%a[i]

print(ans)

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))

print((sum(a) - n))
# Original solution
n=int(eval(input()))
xl=[list(map(int,input().split())) for _ in range(n)]
xl.sort(key=lambda x: x[0])
ans=0
for i in range(n):
  xi,li=xl[i]
  cnt=1
  for j in range(n):
    xj,lj=xl[j]
    if xi+li<=xj-lj:
      cnt+=1
      xi=xj
      li=lj
  ans=max(ans,cnt)
print(ans)


# Optimized solution
n=int(eval(input()))
xl=[list(map(int,input().split())) for _ in range(n)]
xl.sort(key=lambda x: x[0])
cnt=0
nx,nl=xl[0]
for i in range(1,n):
  x,l=xl[i]
  if nx+nl<=x-l:
    nx=x
    nl=l
  else:
    cnt+=1
    if nx+nl>=x+l:
      nx=x
      nl=l
print((n-cnt))
# Original solution
H = int(eval(input()))
x = [[float('inf')]*2 for i in range(H)]

for i in range(H):
    X, L = list(map(int, input().split()))
    x[i][0] = X - L
    x[i][1] = X + L

from operator import itemgetter
sf = sorted(x, key=itemgetter(1))

ans = 0
last = float('inf')*-1

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

print(ans)


# Optimized solution
N = int(eval(input()))
S = []
for i in range(N):
    xi, li = list(map(int, input().split()))
    S.append([xi - li, xi + li])

from operator import itemgetter
S = sorted(S, key=itemgetter(1))

ans = 0
last = -1*float('Inf')
for si in S:
    if si[0] >= last:
        ans += 1
        last = si[1]

print(ans)
# Original solution
import math
import sys

m=10**9 + 7 
sys.setrecursionlimit(1000010)
INF=10 ** 10
N = int(eval(input()))
XL = sorted([list(map(int,input().split())) for _ in range(N)])
# print(N,XL)

DP = [ INF for _ in range(N+1)]
DP[0] = -INF
for i in range(N):
    #print(DP)
    (x,l) = XL[i]
    # print(x,l)
    for j in range(1,N+1):
        if DP[j-1] > x -l:
            break
        if ( DP[j-1]<= x -l and x + l < DP[j]):
                DP[j] = x + l
#print(DP)
for i in range(2,N+1):
    if DP[i] == INF:
        print((i-1))
        exit(0)
print(N)



# Optimized solution
import math
import sys

m=10**9 + 7 
sys.setrecursionlimit(1000010)
INF=10 ** 10
N = int(eval(input()))
XL = [list(map(int,input().split())) for _ in range(N)]
XLs =sorted([ [xl[0]+xl[1],xl[0]-xl[1]] for xl in XL ])
# print(N,XL,XLs)

t = -INF 
n = 0

for xl in XLs:
    if t <= xl[1]:
        t = xl[0]
        n = n + 1
print(n)
# Original solution
n = int(eval(input()))


dat = []
for _ in range(n):
    x, l = list(map(int, input().split()))
    #           0  1   2    3    4co     5
    dat.append([x, l, x-l, x+l, 0     , []])
dat.sort(key = lambda x: x[1], reverse=True)
#print(dat)
res = []
res_safe = []
def do_count():
    for i in range(n):
        #print("i={0}".format(i))
        c = 0
        m = []
        for j in range(i+1, n):
            #print("j={0}".format(j))
            if dat[j][3] <= dat[i][2] or dat[i][3] <= dat[j][2]:
                pass
            else:
                dat[i][5].append(dat[j])
                dat[j][5].append(dat[i])
                dat[i][4] += 1
                dat[j][4] += 1

do_count()
dat.sort(key = lambda x: (x[4], x[1]), reverse=True)
#print(dat)
for i in range(n):
    if dat[i][4] == 0:
        res.append(dat[i])
        continue
    #print("node {0}: kill".format(i))
    for node in dat[i][5]:
        #print(node[5])
        for x in range(len(node[5])):
            if node[5][x] == dat[i]:
                node[4] -= 1
                del node[5][x]
                #print("!!!!")

#print(res)
print((len(res)))


# Optimized solution
n = int(eval(input()))
dat = []
for _ in range(n):
    x, l =list(map(int, input().split()))
    dat.append([x-l, x+l])
dat.sort(key=lambda x: x[1])
#print(dat)
prevr = -99999999999999999
res = 0
for i in range(n):
    if dat[i][0] >= prevr:
        prevr = dat[i][1]
        res += 1
print(res)
# Original solution
from collections import deque

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

p = deque()

for i in list:
  p.append([i[0] - i[1],i[0] + i[1]])
  
p = sorted(p,key = lambda x: x[1])

ex = []
ex.append(p.pop(0))




for i in range(len(p)):
  if(ex[-1][1] <= p[0][0]):
    ex.append(p.pop(0))
  else:
    p.pop(0)

print((len(ex)))

# Optimized solution
from collections import deque

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

p = []
for i in list:
  p.append([i[0] - i[1],i[0] + i[1]])
  
p = sorted(p,key = lambda x: x[1])

p = deque(p)
ex = []
ex.append(p.popleft())




for i in range(len(p)):
  if(ex[-1][1] <= p[0][0]):
    ex.append(p.popleft())
  else:
    p.popleft()

print((len(ex)))
# Original solution
import sys
from collections import deque, Counter, defaultdict
from itertools import permutations
import heapq


def resolve():
    N = int(sys.stdin.readline().strip())
    pq = []
    for _ in range(N):
        X, L = list(map(int, sys.stdin.readline().strip().split()))
        heapq.heappush(pq, (X + L, X - L))
    ans = 0
    while pq:
        ans += 1
        right, _ = heapq.heappop(pq)
        if pq:
            _, next_left = min(pq)
            while next_left < right:
                heapq.heappop(pq)
                if not pq:
                    break
                _, next_left = min(pq)

    print(ans)


if __name__ == "__main__":
    resolve()


# Optimized solution
import sys
from collections import deque, Counter, defaultdict
from itertools import permutations
import heapq


def resolve():
    N = int(sys.stdin.readline().strip())
    pq = []
    for _ in range(N):
        X, L = list(map(int, sys.stdin.readline().strip().split()))
        heapq.heappush(pq, (X + L, X - L))
    ans = 0
    while pq:
        ans += 1
        right, _ = heapq.heappop(pq)
        if pq:
            _, next_left = pq[0]
            while next_left < right:
                heapq.heappop(pq)
                if not pq:
                    break
                _, next_left = pq[0]

    print(ans)


if __name__ == "__main__":
    resolve()
# Original solution
N = int(eval(input()))
XL = [list(map(int, input().split())) for _ in range(N)]

t = [(x + l, x - l) for x, l in XL]
t.sort()
max_r = -float('inf')
result = 0
for i in range(N):
    r, l = t[i]
    if max_r <= l:
        result += 1
        max_r = r
print(result)

# Optimized solution
from operator import itemgetter

def solve():
    N = int(eval(input()))
    X = []
    for i in range(N):
        xx, ll = list(map(int, input().split()))
        X.append((xx-ll, xx+ll))
    X.sort(key=itemgetter(1))
    count = 0
    cur = -float('inf')
    for i in range(N):
        c, d = X[i]
        if cur <= c:
            count += 1
            cur = d
    return count

print((solve()))
# Original solution
n = int(eval(input()))
l = []
for _ in range(n):
  x,y = list(map(int, input().split()))
  l.append([x+y,x-y])
l.sort()

temp = l[0][0]
count = n
i = 1
for i in range(1,n):
  if temp <= l[i][1]:
    temp = l[i][0]
  else:
    temp = min(temp,l[i][0])
    count -= 1
print(count)

# Optimized solution
n = int(eval(input()))
l = []
for _ in range(n):
  x,y = list(map(int, input().split()))
  l.append([x+y,x-y])
l=sorted(l)
 
tmp = l[0][0]
count = n
for p in l[1:]:
  if tmp <= p[1]:
    tmp = p[0]
  else:
    tmp = min(tmp,p[0])
    count -= 1
print(count)
# Original solution
def main():
    N = int(eval(input()))
    L = []
    for i in range(N):
        xi, li = list(map(int, input().split()))
        s = xi - li
        f = xi + li
        L.append((s, f))
    
    L.sort(key=lambda x: x[1])

    ans = 0
    while L:
        e = L[0]
        L = [i for i in L if i[0] >= e[1]]
        ans += 1
    
    print(ans)

if __name__ == "__main__":
    main()



# Optimized solution
def main():
    N = int(eval(input()))
    L = []
    for i in range(N):
        xi, li = list(map(int, input().split()))
        s = xi - li
        f = xi + li
        L.append((f, s))
    
    L.sort()

    ans = 0
    finish = -float("inf")
    for i in L:
        if finish <= i[1]:
            ans += 1
            finish = i[0] 

    print(ans)

if __name__ == "__main__":
    main()
# Original solution
N = int(eval(input()))

L = []
R = []

for i in range(N):
    x,l = list(map(int,input().split()))
    L.append( x-l )
    R.append( x+l )

R,L = list(zip(*sorted(zip(R,L))))
cnt = 1
maxR = R[0]
for i in range(1,N):
    if maxR <= L[i]:
        cnt += 1
        if maxR < R[i]:
            maxR = R[i]
            
print(cnt)

# Optimized solution
N = int(eval(input()))

L = []
R = []

for i in range(N):
    x,l = list(map(int,input().split()))
    L.append( x-l )
    R.append( x+l )

R,L = list(zip(*sorted(zip(R,L))))
cnt = 1
maxR = R[0]
for i in range(1,N):
    if maxR <= L[i]:
        cnt += 1
        maxR = R[i]
            
print(cnt)
# Original solution
n = int(eval(input()))
ll = [[0]*i for i in range(n)]
for i in range(n):
  x, l =list(map(int, input().split()))
  ll[i] = [x-l, x+l]
ll = sorted(ll)

l = ll[0]
ans = n

for i in range(n-1):
  li = ll[i+1]
  if l[1] > li[0]:
    ans -= 1
  else:
    l = li

print(ans)

# Optimized solution
n = int(eval(input()))
ll = []
for i in range(n):
  x, l = list(map(int, input().split()))
  ll.append([x-l, x+l])
ll = sorted(ll)

ans = n
r = ll.pop()[0]

while ll:
  while ll and ll[-1][1] > r:
    ans -= 1
    ll.pop()
  if ll:
    r = ll.pop()[0]

print(ans)
# Original solution
n = int(eval(input()))
ll = []
for i in range(n):
  x, l = list(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)

# Optimized solution
import sys
input = sys.stdin.readline

n = int(eval(input()))
ll = []
for i in range(n):
  x, l = list(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)
# Original solution
n = int(eval(input()))
L = []
for _ in range(n):
    x, l = list(map(int, input().split()))
    L.append([x - l, x + l])
L = sorted(L, key=lambda x: x[1])
ans = 0
r = -float('inf')
for i in range(n):
    if L[i][0] >= r:
        ans += 1
        r = L[i][1]
print(ans)


# Optimized solution
n = int(eval(input()))
L = []
for _ in range(n):
    x, l = list(map(int, input().split()))
    left = x - l
    right = x + l
    L.append((left, right))
L = sorted(L, key=lambda x: x[1])
ans = 0
prev = -float('inf')
for r in L:
    if r[0] >= prev:
        ans += 1
        prev = r[1]
print(ans)
# Original solution
from operator import itemgetter
N= int(eval(input()))
ans = 1
a = []

for i in range(N):
    tmpa, tmpb = list(map(int,input().split()))
    if tmpa-tmpb in a:
        a[tmpa-tmpb].append(tmpa+tmpb)
    else:
        a.append([tmpa-tmpb,tmpa+tmpb])

b = sorted(a, key=itemgetter(1))
tmp = b[0][1]
for i in range(1, N):
    if b[i][0] >= tmp:
        ans += 1
        tmp = b[i][1]
print(ans)

# Optimized solution
from operator import itemgetter
N= int(eval(input()))
ans = 1
a = []

for i in range(N):
    tmpa, tmpb = list(map(int,input().split()))
    a.append([tmpa+tmpb, tmpa-tmpb])

a.sort()
    
tmp = a[0][0]
for i in range(1, N):
    if a[i][1] >= tmp:
        ans += 1
        tmp = a[i][0]
print(ans)
# Original solution
import heapq

n = int(eval(input()))
XL = [tuple(map(int, input().split())) for _ in range(n)]

blocked = [0] * n
total = 0
for i in range(n):
    ax, al = XL[i]
    for j in range(i + 1, n):
        bx, bl = XL[j]
        if ax - al < bx - bl < ax + al or ax - al < bx + bl < ax + al:
            blocked[i] -= 1
            blocked[j] -= 1
            total += 1
count = 0
heapq.heapify(blocked)
while total > 0:
    total += heapq.heappop(blocked)
    count += 1

print((n - count))


# Optimized solution
n = int(eval(input()))
LR = [None] * n
for i in range(n):
    x, l = list(map(int, input().split()))
    LR[i] = (x - l, x + l)
LR.sort(key=lambda lr: lr[1])
count = 1
cur = LR[0][1]
for l, r in LR[1:]:
    if cur <= l:
        count += 1
        cur = r
print(count)
# Original solution
n = int(eval(input()))
X = []
L = []
for _ in range(n):
    x, l = list(map(int, input().split()))
    X.append(x)
    L.append(l)
X = sorted(set(X), key=X.index)

areas = [(x - l, x + l)for x, l in zip(X, L)]
for i, (m0, M0) in enumerate(areas):
    for m, M in (areas[:i] + areas[i+1:]):
        if (m0 <= m) and (M <= M0):
            areas.pop(i)
# print(areas)

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

for area in areas:
    if not areas2:
        areas2.append(area)
    elif areas2[-1][-1] <= area[0]:
        areas2.append(area)

# print(areas)
# print(areas2)

print((len(areas2)))

# Optimized solution
# https://atcoder.jp/contests/keyence2020/tasks/keyence2020_b

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

areas = [(x - l, x + l) for x, l in zip(X, L)]
areas = sorted(areas, key=lambda x:x[-1])

# print(areas)

ok = [areas[0]]
for area in areas[1:]:
    if ok[-1][-1] <= area[0]:
        ok.append(area)

# print(ok)
print((len(ok)))
# Original solution
from operator import itemgetter

N = int(eval(input()))
l = []
for i in range(N):
  a, b = list(map(int, input().split()))
  s = [a-b, a+b]
  l.append(s)

l.sort(key = itemgetter(1))
cnt = 0

for i in range(1, N):
  for j in range(i, -N, -1):
    if l[j-1][0] == - 10 ** 9:
      continue
    if l[i][0] < l[j-1][1]:
        l[i][0] = - 10 ** 9
        l[i][1] = - 10 ** 9
        cnt += 1
    break
print((N-cnt))

# Optimized solution
from operator import itemgetter

N = int(eval(input()))
l = []
for i in range(N):
  a, b = list(map(int, input().split()))
  s = [a-b, a+b]
  l.append(s)

l.sort(key = itemgetter(1))
cnt = 0
s = - 10 ** 10
for i in range(N):
  if l[i][0] >= s:
    s = l[i][1]
  else:
    cnt += 1
print((N-cnt))
# Original solution
N = int(eval(input()))

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

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

ans = 0
cur = -1e9
for i in range(N):
    s, t = ST[i]
    if cur <= s:
        ans += 1
        cur = t
print(ans)


# Optimized solution
import sys


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


N = int(eval(input()))

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

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

ans = 0
cur = -1e9
for i in range(N):
    if cur <= XL[i][0]:
        ans += 1
        cur = XL[i][1]
print(ans)
# Original solution
import bisect
N=int(eval(input()))

rllist=[]
for _ in range(N):
  X,L=list(map(int,input().split()))
  rllist.append((X+L,X-L))
rllist.sort()
#print(rllist)

dp=[0]*N
for i in range(N):
  r,l=rllist[i]
  
  pos=bisect.bisect(rllist,(l,float("inf")))
  #print(i,pos)
  dp[i]=max(dp[i-1],dp[pos-1]+1)
  
#print(dp)
print((dp[-1]))

# Optimized solution
N=int(eval(input()))

rllist=[]
for _ in range(N):
  X,L=list(map(int,input().split()))
  rllist.append((X+L,X-L))
rllist.sort()
#print(rllist)

answer=0
max_r=-float("inf")
for r,l in rllist:
  #print(max_r,l)
  if max_r<=l:
    answer+=1
    max_r=max(max_r,r)
  
print(answer)
# Original solution
N=int(eval(input()))

rllist=[]
for _ in range(N):
  X,L=list(map(int,input().split()))
  rllist.append((X+L,X-L))
rllist.sort()
#print(rllist)

answer=0
max_r=-float("inf")
for r,l in rllist:
  #print(max_r,l)
  if max_r<=l:
    answer+=1
    max_r=max(max_r,r)
  
print(answer)

# Optimized solution
N=int(eval(input()))

rllist=[]
for _ in range(N):
  X,L=list(map(int,input().split()))
  rllist.append((X+L,X-L))
rllist.sort()
#print(rllist)

answer=0
max_r=-float("inf")
for r,l in rllist:
  #print(max_r,l)
  if max_r<=l:
    answer+=1
    max_r=r
  
print(answer)
# Original solution
n = int(eval(input()))
lst = []
for i in range(n):
    x,l = list(map(int,input().split()))
    if x-l < 0:
        # [右端の位置,左端の位置]
        lst.append([x+l,0])
    else:
        lst.append([x+l,x-l])
lst.sort()


# [[6, 0], [7, 1], [12, 6], [105, 95]]

# 最初のロボットの選択
now = lst[0][0]
cnt = 1
idx = 1


for i in range(idx,n):
    if now <= lst[i][1]:
        now = lst[i][0]
        cnt += 1
        idx = i + 1
print(cnt)

# Optimized solution
n = int(eval(input()))
lst = []
for i in range(n):
    x,l = list(map(int,input().split()))
    if x-l < 0:
        # [右端の位置,左端の位置]
        lst.append([x+l,0])
    else:
        lst.append([x+l,x-l])
lst.sort()


# 最初のロボットの選択
now = lst[0][0]
cnt = 1


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

print(cnt)
# Original solution
n = int(eval(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)




# Optimized solution
n = int(eval(input()))
a = []
for i in range(n):
    x,l = list(map(int,input().split()))
    s = x-l
    g = x+l
    a.append((s,g))

a = sorted(a, reverse=False, key=lambda x: x[1]) 
tmp = a[0][1]
ans = 1
for i in range(1,len(a)):
    if tmp <= a[i][0]:
        tmp = a[i][1]
        ans += 1 

print(ans)
# Original solution
a = int(eval(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: student[0] + 100000000000000000000 * student[1])

maxer = 0
for i in range(len(fanwei)):
    now = -100000000000000000000
    ans = 0
    for i in fanwei[i:]:
        down = i[0]
        if down >= now:
            ans += 1
            now = i[1]
    maxer = max(ans, maxer)

print(maxer)


# Optimized solution
a = int(eval(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: student[0] + 100000000000000000000 * student[1])

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


print(ans)
# Original solution
from collections import defaultdict
n = int(eval(input()))
r = []
for i in range(n):
    x, l = list(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]:
            am[i].append(j)
            am[j].append(i)
while sum(len(mi) for mi in am):
    maxi, maxd = 0, 0
    for i, mi in enumerate(am):
        li = len(mi)
        if li > maxd:
            maxi, maxd = i, li
    for pi in am[maxi]:
        am[pi].remove(maxi)
    am.pop(maxi)
    n -= 1
print(n)

# Optimized solution
n = int(eval(input()))
r = []
for i in range(n):
    x, l = list(map(int, input().split()))
    r.append((x - l, x + l))
r.sort(key=lambda _x: _x[1])
cnt = 1
limit = r[0][1]
for ri in r[1:]:
    if ri[0] >= limit:
        cnt += 1
        limit = ri[1]
print(cnt)
# Original solution
N = int(eval(input()))
# X = []
# L = []
# for _ in range(N):
#   x, l = map(int, input().split()))
#   X.append(x)
#   L.append(l)

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


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

l = []
ans = 0
for i in range(N):
  count = 0
  for j in range(N):
    if i == j:
      continue
    else:
      if A[i] <= A[j] <= B[i] or A[i] <= B[j] <= B[i]:
        count += 1
  l.append(count)
print((N - l.count(max(l)) if max(l) != 0 else N))

# Optimized solution
N = int(eval(input()))
robot = []
for _ in range(N):
  r = []
  x, l = list(map(int, input().split()))
  a = x + l - 1
  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)))