import fractions

def lcm(lst):
    if len(lst) == 2:
        return (lst[0] * lst[1]) // fractions.gcd(lst[0], lst[1])
    l = lcm(lst[1:])
    return (lst[0] * l) // fractions.gcd(lst[0], l)

n = int(input())
inputs = list(map(int, input().split(' ')))
x = lcm(inputs) - 1
s = 0
for i in inputs:
    s += x % i
print(s)
