def gcd(x, y):
    if x % y:
        return gcd(y, x % y)
    return y

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

n = int(input())
a = sorted([int(i) for i in input().split()])
l = a[0]
for i in a[1:]:
    l = lcm(l, i)
print(sum(map(lambda x: (l - 1) % x, a)))
