import fractions
import numpy as np
n = int(input())
a = np.array([int(i) for i in input().split()])
lcm = a[0]
for i in a:
    lcm = int(lcm * i / fractions.gcd(lcm, i))
x = lcm - 1
x = np.ones(n) * x
print(int(np.sum(x % a)))