N = int(input())
A = list(map(int, input().split()))

def euclid(a, b):
    m = min(a,b)
    n = max(a,b)
    if (n%m==0):
        return m
    else:
        return euclid(m, n%m)

def sub_lcm(X):
    Y = []
    P, Q = len(X)//2, len(X)%2
    for p in range(P):
        a, b = X[2*p], X[2*p+1]
        y = a * b // euclid(a,b)
        Y.append(y)
    if Q!=0:
        Y.append(X[-1])
    return Y

def lcm(X):
    Y = sub_lcm(X)
    while len(Y)>1:
        Y = sub_lcm(Y)
    return Y[0]

y = lcm(A)-1
s = 0
for a in A:
    s += y%a
print(s)
