n = int(input())
a = list(map(int,input().split()))

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

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

ans = a[0]
for i in range(n-1):
    ans = lcm(ans,a[i+1])

ans2 = 0
for i in range(n):
    ans2 += ans%a[i]
print(ans2)