from functools import reduce
from fractions import gcd
n = input()
a = list(map(int,input().split()))
gd = reduce(gcd,a)
m = reduce(lambda a,b: a*b,a)/gd -1
sum = sum(map(lambda x: m%x,a))

print(int(sum))