import math

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

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

j=lcm(A[0],A[1])
for i in range(2,len(A)):
    j=lcm(j, A[i])

tmp=[]
for i in A:
    tmp.append((j-1)%i)
ans=sum(tmp)
print(ans)
