import math

N = int(input())
a = list(map(int, input().split()))
ans = 0
num = 0
for i in range(1, len(a)):
	num *= int(a[i-1] * a[i] / math.gcd(a[i-1],a[i]))
num -= 1
for i in range(len(a)):
	ans += num % a[i]
print(ans)