from fractions import gcd
def lcm(a,b): return abs(a * b)/gcd(a,b) if a and b else 0

n = input()

xs = [int(x) for x in input().split()]

from functools import reduce

mlcm = int(reduce(lcm, xs))

mlcm -= 1
print(sum([ mlcm%x for x in xs]))