n = int(input())
a = list(map(int,(input().split())))
import math
from functools import reduce

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

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

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

x = lcm(*a)

x = x - 1
result = 0
for i in a:
    result += x % i

print(result)
