def gcd(a, b):
    a, b = max(a, b), min(a, b)
    if a % b == 0:
        return b
    else:
        return gcd(b, a%b)
def lcm(a, b):
    return int(a * b / gcd(a, b))

N = int(input())
a = [int(i) for i in input().split()]

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

modTotal = 0
for i in range(N):
    modTotal += LCM % a[i]
print(modTotal)