# -*- coding: utf-8 -*-

import functools
import fractions

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

def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

max_under_lcm = functools.reduce(lambda x, y: int((x * y) / fractions.gcd(x,y)), numbers) - 1
sum = 0
for n in numbers:
    sum += max_under_lcm % n
answer = sum

print(answer)
~             