def gcd(x, y):
    x, y=max(x,y), min(x,y)
    if y==0:
        return x
    return gcd(y, x%y)

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

n=int(input())
a=list(map(int,input().split()))

a_lcm=1
for i in range(n):
    a_lcm=lcm(a_lcm, a[i])

ans=0
for i in a:
    ans+=(a_lcm-1)%i
print(ans)