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

import math
import functools

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

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

max_under_lcm = functools.reduce(lcm, numbers) - 1
answer = sum([ max_under_lcm % n for n in numbers])

print(answer)