import functools
import math
def slcm(numbers):
	return functools.reduce(lambda x,y:x*y//math.gcd(x,y),numbers)

input()
numbers=list(map(int,input().split()))
num=slcm(numbers)-1
print(sum([num%i for i in numbers]))