import math
import operator
from functools import reduce
N = int(input())
a_list = list(map(int, input().split(' ')))

def lcm_list(numbers):
    return reduce(operator.mul, numbers) // reduce(math.gcd, numbers)

m = lcm_list(a_list) - 1

print(sum([m % a for a in a_list]))
