import math

n=input()
a=[int(i) for i in input().split()]
ac=a[:]


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

while(len(ac)>1):
    x=ac.pop()
    y=ac.pop()
    ac.append(lcm(x, y))

g=ac[0]-1

ans=0
for i in a:
    ans+=g%i

print(ans)
