import math

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

N = int(input())
a = list(map(int,input().split()))
a.sort()
tlcm = lcm(a[0],a[1])

for i in range(2,len(a)):
	tlcm = lcm(a[i],tlcm)

tlcm = tlcm - 1
result = 0
for i in range(len(a)):
	result += tlcm % a[i]
print(result)