import math
n=int(input())
box=list(map(int,input().split()))
count=box[0]

for i in range(1,n):
    count=(box[i]*count)//math.gcd(box[i],count)

point=0
count -=1
for i in box:point +=count%i

print(point)