import math
N = int(input())
a = input().split()
a = [int(i) for i in a]
res_list = {}
def lcm(x,y):
    return (x * y) // math.gcd(x, y)
for i in range(len(a)):
    if i == 0:
        res = a[i]
        continue
    else:
        res = lcm(res,a[i])
res2 = 0
for i in a:
    res2 += (res-1) % i
print(res2)