from math import gcd


def solve(n, ax):
    lcm = 1
    for ai in ax:
        lcm = lcm*ai//gcd(lcm, ai)
    m=lcm-1
    return sum(list(map(lambda x: (lcm-1)%x, ax)))


if __name__ == '__main__':
    n = int(input())
    ax = list(map(int, input().split()))
    print(solve(n, ax))
