from fraction import gcd
def lcm(a, b):return a * b // gcd(a,b)
N = int(input())
A = [int(i) for i in input().split()]
B = lcm(A[0],A[1])
ans = 0
for i in A:
    B = lcm(B,i)
for i in A:
    ans += (B-1)%i
print(ans)