import math
from functools import reduce
n=int(input())
box=list(map(int,input().split()))

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

def lcm_list(numbers):
    return reduce(lcm_base,numbers,1)

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

print(point)