import fractions

n = int(eval(input()))

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



LCM = a[0]

for i in range(1, n):

    LCM = LCM * a[i] // fractions.gcd(LCM, a[i])



ans = 0

for i in range(n):

        ans += (LCM - 1)%a[i]

print(ans)
import fractions

def lcm(a):

    LCM = a[0]

    for i in range(1, n):

        LCM = LCM * a[i] // fractions.gcd(LCM, a[i])

    return LCM



n = int(eval(input()))

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



m = lcm(a) - 1

ans = 0



for i in range(n):

    ans += m%a[i]



print(ans)
import fractions

n = int(eval(input()))
a = list(map(int, input().split()))
LCM = a[0]
for i in range(1, n):
    LCM = LCM * a[i] // fractions.gcd(LCM, a[i])
ans = 0
for i in range(n):
    ans += (LCM - 1) % a[i]
print(ans)

import fractions


def lcm(a):
    LCM = a[0]
    for i in range(1, n):
        LCM = LCM * a[i] // fractions.gcd(LCM, a[i])
    return LCM


n = int(eval(input()))
a = list(map(int, input().split()))
m = lcm(a) - 1
ans = 0
for i in range(n):
    ans += m % a[i]
print(ans)

+ + +def lcm(a): +    LCM = a[0] +    for i in range(1, n): +        LCM = LCM * a[i] // fractions.gcd(LCM, a[i]) +    return LCM + -LCM = a[0] -for i in range(1, n): -    LCM = LCM * a[i] // fractions.gcd(LCM, a[i]) +m = lcm(a) - 1 -    ans += (LCM - 1) % a[i] +    ans += m % a[i]