n = int(input())
a = [int(x) for x in input().split()]
def gcd(a,b):
    while b>0:
        a,b = b, a%b
    return a
def lcm(a,b):
    return a/gcd(a,b) * b
lcm_sum=1
f=0
for i in a:
    lcm_sum = lcm(lcm_sum, i)
for i in a:
    f+=(lcm_sum-1) % i
print(int(f))