def lcm (x, y):
    return (x * y) // gcd(x, y)

N = int(input())
a = list(map(int, (input().split())))
l = (a[0] * a[1]) // gcd(a[0], a[1])

for i in a[2:]:
    l = lcm(l, i)

l -= 1

ans = sum(map(lambda x: l%x , a))
print(ans)