import math
from functools import reduce
def b(x, y):
    return (x * y) // math.gcd(x, y)
_ = int(input())
a = [int(x) for x in input().split()]
m = reduce(b, a, 1) - 1
print(sum([m % a_i for a_i in a]))