from functools import reduce
import math

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

lcm = reduce(lambda x, y: (x * y) // math.gcd(x, y), A)

score = 0
for a in A:
    score += (lcm - 1) % a

print(score)