import sys
import numpy as np
#import math
# for AtCoder
import fractions
from collections import deque 
from functools import reduce

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

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

# N 
n = int(input())

# a1 . . . an
a = list(map(int, input().split()))

lcm_1 = lcm_list(a) - 1
m = np.mod(lcm_1, a)
print(m.sum())
