N = int(input())

a = list(map(int, input().split()))

b = a

ans = 0

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

def lcm_list(l):
    for i in range(len(l)):
        if i == len(l) - 1:
            break
        l[i+1] = lcm(l[i], l[i+1])
    return l[len(l) - 1]

for i in range(len(a)):
    ans += (lcm_list(a) - 1) % b[i]
    
print(ans)