import math
from functools import reduce
def lcm(x,y):
  return(x*y)//math.gcd(x,y)

n=int(input())
A=list(map(int,input().split()))
num=reduce(lcm,A)
def f(n):
  return sum(list(map(lambda x:n%x,A)))
print(f(num-1))