def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a

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

def lcm_lst(lst):
  if len(lst) == 1:
    return lst[0]
  return lcm(lst[0], lcm_lst(lst[1:]))


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

m = lcm_lst(a)-1
f = 0
for a_ in a:
    f += m % a_
print(f)
