import os, sys, re, math

from functools import reduce
def lcm(vals):
    return reduce((lambda x, y: (x * y) // math.gcd(x, y)), vals, 1)

lines = sys.stdin.readlines()

n = int(lines[0])
a = [int(k) for k in lines[1].split()]

m = lcm(a) - 1
print (sum([m % k for k in a]))
