import math
from functools import reduce

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

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

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

j = lcm_list(a)

cnt = 0
for i in a:
    cnt += (j-1)%i

print(cnt)
