import sys

# 最大公約数
def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a

# 最小公倍数
def lcm(a, b):
  return a*b/gcd(a, b)

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

lcm_num = lcm(a[0], a[1])

for i in range(2, n):
    lcm_num = lcm(lcm_num, a[i])

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

print(int(ans))
  
