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