#ABC 103
import math
from functools import reduce

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
N=int(input())
A = [int(j) for j in input().split()]

ans = 0
for a in A:
    ans+=(lcm(*A)-1)%a
print(ans)