import math

def lcm(a, b):
    return (a * b) // math.gcd(a, b)
l = 1
n = int(input())
arr = [int(i) for i in input().split()]
for i in arr:
    l = lcm(i, l)
ans = 0
for i in arr:
    ans += (l - 1) % i
print(ans)