from functools import reduce

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

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

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

ans = 0
for x in a:
    ans += (reduce(lcm, a) - 1) % x

print(ans)