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