from itertools import accumulate
from math import gcd
def lcm_(x,y):
    return x*y//gcd(x,y)
def lcm(numbers):
    return list(accumulate(numbers,lcm_))
n=int(input())
A=[int(i) for i in input().split()]
L=lcm(A)[-1]-1
f=0
for i in A:
    f+=L%i

print(f)