import math
import functools

def main() :
    lcm_base = lambda x, y : (x * y) // math.gcd(x, y)
    n = int(input())
    a = list(map(int, input().split()))
    lcm = int(functools.reduce(lcm_base, a, 1))

    ans = 0
    for aa in a :
        ans += (lcm-1) % aa

    print(ans)

main()