def gcd(a, b):
    if(a < b):
        a, b = b, a

    while b:
        a, b = b, a % b
    return a

def lcm(a,b):
    return a*b / gcd(a,b)

n = int(input())
a = list(map(int, input().split()))
nums = 1
for i in range(n):
    nums = lcm(nums, a[i])
ans = 0
for i in a:
    ans += (nums - 1) % i
print(int(ans))
