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

def gcd(x,y):#ユークリッドの互除法
  if y > x:
    x, y = y, x
  while y != 0:
    x, y = y, x % y
    if y == 0:
      return x
    
def lcm(x,y):
  return x * y / gcd(x,y)

m = 1
for i in range(N):
  m = lcm(m, A[i])
  
count = 0
for i in range(N):
  count += (m - 1) % A[i]
  
print(int(count))