import fractions



n = int(eval(input()))

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



lcm = a[0]

for i in a:

    lcm = lcm * i // fractions.gcd(lcm, i)



ans = 0

for i in a:

    ans += (lcm-1) % i

print((int(ans)))

n = int(eval(input()))

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



ans = 0

for i in a:

    ans += i - 1

print(ans)
import fractions

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

n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in a:
    ans += i - 1
print(ans)

-import fractions - -lcm = a[0] -for i in a: -    lcm = lcm * i // fractions.gcd(lcm, i) -    ans += (lcm - 1) % i -print((int(ans))) +    ans += i - 1 +print(ans)