fun main(args: Array<String>) {
  val N = readInt()
  val A = readLongs()

  var lcm = 1L
  for (i in 0 until N) {
    lcm = lcm(lcm, A[i])
  }
  var sum = 0L
  for (i in 0 until N) {
    sum += (lcm - 1) % A[i]
  }

  println(sum)
}

fun gcd(a: Int, b: Int): Int = if (a < b) gcd(b, a) else if (b == 0) a else gcd(b, a % b)
fun gcd(a: Long, b: Long): Long = if (a < b) gcd(b, a) else if (b == 0L) a else gcd(b, a % b)
fun lcm(a: Int, b: Int): Int = (a * b) / gcd(a, b)
fun lcm(a: Long, b: Long): Long = (a * b) / gcd(a, b)

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readInts() = readLine()!!.split(" ").map { it.toInt() }
fun readLongs() = readLine()!!.split(" ").map { it.toLong() }
