import fraction
from functools import reduce


def lcm_base(x, y):
    return (x * y) // fraction.gcd(x, y)

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)


N = int(input())
A = list(map(int, input().split()))
L = lcm(A) - 1

result = 0

for a in A:
    result += (L % a)

print(result)
