import math
from functools import reduce

def lcm(a, b):
    return (a * b) // math.gcd(a,  b)

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

N = int(input())
a = list(map(int, input().split()))


i = lcm_list(a) -1
print(sum([i%j for j in a]))
