fun main(args: Array<String>) {
    val N = nextInt()
    val A = listOfLong()
    val l = A.reduce { acc, v ->  lcm(acc, v) } - 1
    val ans = A.sumByLong { l % it }
    println(ans)
}
fun gcd(a: Long, b: Long): Long = if (b > 0) gcd(b, a % b) else a
fun lcm(a: Long, b: Long): Long = a / gcd(a, b) * b
inline fun <T> Iterable<T>.sumByLong(selector: (T) -> Long): Long {
    var sum = 0L
    for (element in this) sum += selector(element)
    return sum
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun nextInt(offset: Int = 0) = nextInt() + offset
fun listOfString() = next().split(" ")
fun listOfLong() = listOfString().map { it.toLong() }



