import math
from functools import reduce

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

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

res = 0
tmp = reduce(lcm,a)-1
for i in a:
    res += tmp % i
print(res)