import math
from functools import reduce

n = int(input())
a = [int(i) for i in input().split()]

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

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

c = lcm_list(a) - 1

f = 0
for i in a:
    f += c % i

print(f)