n=int(input())
a=[int(x) for x in input().split()]
import numpy as np
import math
from functools import reduce
def gcd(numbers):
    return reduce(math.gcd, numbers)
lcm=np.prod(a)//gcd(a)
print(sum([(lcm-1)%ai for ai in a]))