from sys import stdin
import numpy as np

N = int(stdin.readline().rstrip().split()[0])
A = [int(x) for x in stdin.readline().rstrip().split()]

def LCM(_a, _b):
  if _a < _b:
    a, b = _b, _a
  else:
    a, b = _a, _b
  while True:
    c = a%b
    if c==0:
      break
    a,b = b,c
  return (_a*_b)//b

def func(a_list):
  size = len(a_list)
  if size ==2:
    return LCM(a_list[0],a_list[1])
  else:
    return LCM(a_list[0], func(a_list[1:]))

lcm_1 = func(A)-1
print(sum(list(map(lambda x: lcm_1%x, A))))