import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


n = input()
a = list(int(i) for i in input().split())

lcm = lcm_list(a) - 1

out = 0
for i in a:
    out += lcm%i
print(out)
