from multiprocessing import Pool
from functools import reduce
from math import ceil

class Solver(object):
    def __init__(self):
        pass

    def solve(self):
        pass

memo = {}
def gcd(a, b):
    """a = bq + r"""
    if (a, b) not in memo:
        a, b = (max(a, b), min(a, b))
        if b == 0:
            memo[(a, b)] = a
        else:
            r = a % b
            memo[(a, b)] = gcd(b, r)
    return memo[(a, b)]

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


if __name__ == "__main__":
    n = int(input())
    a_s = list(map(int, input().split(" ")))
    gcd_a = int(reduce(gcd, a_s))
    lcm_a = int(reduce(lcm, a_s))
    def mod(x):
        return (lcm_a-1) % x
    fm = sum(map(mod, a_s))
    print(fm)
