import math
from functools import reduce


N = int(input())

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

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

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

for i in range(len(a)):
    ans += (lcm_list(a) - 1) % a[i]
    
print(ans)