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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1) - 1

if __name__ == "__main__":        
    N = int(input())
    array = list(map(int, input().split()))
    # num = reduce(lcm_base, array, 1) - 1
    num = lcm(*array)
    count = 0
    for i in range(0, len(array)):
        count += num % array[i]
    
    print(count)