import math
 
N=int(input())
A=[int(i) for i in input().split()]
 
def Lcm(A):
    ans=A[0]
    for i in A[1:]:
        ans = ans * i // math.gcd(ans,i)
    return ans
 
m = Lcm(A)-1
ans = 0
 
for i in A:
    ans += m%i
    
print(ans)