def gcd(a, b):
    if b == 0: return a
    mod = a % b
    buf = gcd(b, mod)
    return buf

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

n = input()
a_li = list(map(int,input().split()))

lcm_a = 0
for i in range(len(a_li)) :
    if i == 0 :
        lcm_a = a_li[i]
    else :
        lcm_a = lcm(lcm_a, a_li[i])

m = lcm_a - 1
f = 0
for i in range(len(a_li)) :
    f = f + m % a_li[i]

print(f)