gcd = lambda x, y: x if (y==0) else gcd(y, x%y)
lcm = lambda x, y: int(x*y/gcd(x, y))

N = int(input())
A = list(map(int, input().split()))

gcd_all = 0
lcm_all = 1

for ai in A :
    gcd_all = gcd(gcd_all, ai)
    lcm_all = lcm(lcm_all, ai)

m = lcm_all - 1
print(sum(list(map(lambda ai: m%ai, A))))
