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)

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

lcm = lcm_list(a)

ans = 0
for i in range(n):
    ans += (lcm-1) % a[i]

print(ans)