N = int(input())
a = list(map(int, input().split()))
ans = 0
import math
from functools import reduce
def lcm_base(x, y):
    return int((x * y) / math.gcd(x, y))
def lcm_list(numbers):
    ans = 0
    for i in range(1,len(numbers)):
        if(i == 1):
            ans = lcm_base(numbers[0], numbers[1])
        else:
            ans = lcm_base(ans, numbers[i])
    return ans

min_bin= lcm_list(a)

# ans = 0
for i in a:
    ans += (min_bin-1) % i
    # print(tmp)
print(ans)
