import numpy as np
from functools import reduce
from fractions import gcd

N = int(input())
A = np.array(list(map(int, input().split())))

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

l = lcm(*A) # lは最小公倍数
print(((l-1) % A).sum())
