length = int(input())

numbers = list(map(int, input().rstrip().rsplit(' ')))

r = numbers[0]
for num in numbers[1:]:
    r %= num
    while r != 0:
        a = num
        num = r
        r = a % num
    
    r = num

mul = 1
for num in numbers:
    mul *= num

rest = 0
for num in numbers:
    rest += int(mul / r - 1) % num
    
print(rest)