from functools import reduce
import math
n = int(input())
a = list(map(int, input().split()))

#最小公倍数−1
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

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

m = lcm_list(a)-1
sum = 0
for i in a:
    sum += m%i

print(sum)