import fractions
import functools
N = int(input())
a = list(map(int, input().split()))

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

def lcm_list(lst):
    return functools.reduce(lcm,lst)

lcma = lcm_list(a)-1
res = 0
for i in a:
    res += lcma%i
print(int(res))