from math import gcd
N = int(input())
A = list(map(int,input().split()))

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

l = A[0]
for i in range(1,N):
    l = lcm(l,A[i])
l -= 1

ans = 0
for a in A: ans += l % a
print(ans)