n= int(input())
a =list(map(int,input().split()))
ans = a[0]

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b,a%b)

for i in range(n-1):
    ans = ans*a[i+1] / gcd(ans,a[i+1])
sum = 0
for i in range(n):
    sum += (ans-1)%a[i]
print(int(sum))