# C
from functools import reduce
from functools import lru_cache
import math

@lru_cache(None)
def lcm(a, b):
    return int(a*b/math.gcd(a, b))

n = int(input()) 
a = list(map(int, input().split()))

result = 0
mod = reduce(lcm, a)-1

for i in range(len(a)):
    result += mod % a[i] 

print(int(result))