import fractions
from functools import reduce

def lcm(a, b):
    return (a * b) // fractions.gcd(a, b)
def lcm_list(l):
    return reduce(lcm, l, 1)

n = int(input())
a = list(map(int, input().split()))
f = 0
for j in range(n):
    f += (lcm_list(a) - 1) % a[j]
print(f)
