import math
from functools import reduce

n = int(input())
a = list(map(int, input().split(' ')))

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

def lcm_list(l):
    return reduce(lcm, l, 1)

fm = 0
m = lcm_list(a) - 1
for item in a:
    fm += m % item

print(fm)
