from math import gcd
from functools import reduce

def lcm(p,q):
    return p*q//gcd(p,q)

N=int(input())
a=list(map(int,input().split(' ')))
m=reduce(lcm,a)-1
result=0
for i in a:
    result+=m%i
print(result)
