import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextInt()
  val a = (1..n).map { sc.nextLong() }

  val lcm = nlcm(a).toLong()

  var ans = 0L
  for (ai in a) {
    ans += (lcm - 1L) % ai.toLong()
  }
  println(ans)

}

private fun gcd(a: Long, b: Long): Long {
  if (b > 0) {
    return gcd(b, a % b)
  }
  return a
}

private fun lcm(a: Long, b: Long): Long {
  val res = a / gcd(a, b) * b
  return res.toLong()
}

private fun nlcm(numbers: List<Long>): Long {
var res: Long
res = numbers.get(0)
for (i in 1 until numbers.size) {
    res = lcm(res, numbers.get(i))
}
return res
}
