import math
N = int(input())
a = list(map(int, input().split()))

# mはaの(最小公倍数 - 1)
lcm = a[0]
for item in a[1:]:
    lcm = (lcm * item) // math.gcd(lcm, item)
f = 0
for item in a:
    f += (lcm - 1) % item
print(f)