n = int(input())
a = list(map(int, input().split()))
def gcm(a, b) :
  while(b) :
    a, b = b, a%b
  return a
def lcm(a, b) :
  return int(a*b/gcm(a, b))

b = a[0]
for i in range(n-1) :
  b = lcm(b, a[i+1])
  
print(sum([(b-1)%a[i] for i in range(n)]))