import copy
N = int(input())
ai = list(map(int, input().split()))

def lcm_list(l):
    if len(l) <= 1:
        return l[0]
    
    a = l.pop(len(l)-1)
    b = l.pop(len(l)-1)
    ans = lcm(a, b)
    l.append(ans)
    return lcm_list(l)

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

def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    return gcd(b, a % b)

bi = copy.deepcopy(ai)
lcm_a = lcm_list(ai) - 1
ans = 0
for a in bi:
    ans += lcm_a % a

print(ans)