import math
from functools import reduce

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

def lcm_base(x, y):
	return (x * y) // math.gcd(x, y)
	
def lcm_list(numbers):
	return reduce(lcm_base, numbers, 1)
	
lcmNum = lcm_list(ANs)
#print(lcmNum)
#print(lcmList)

f = 0
for a in ANs:
	f += (lcmNum-1)%a
print(f)