import math
from functools import reduce


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

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



n = int(input())

l = list(map(int, input().split()))

lcm = lcm_list(l)
a = lcm-1
mod_all = 0

for i in l:
    mod_all += a%i

print(mod_all)

