object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val N = sc.nextInt()
    val A = Array.fill(N)(sc.nextLong())

    def gcd(a: Long, b: Long): Long =
      if (a % b == 0L) b
      else gcd(b, a % b)

    def lcm(a: Long, b: Long): Long =
      a * (b / gcd(a, b))

    val LCM = A.reduce((a, b) => lcm(a, b)) - 1L
    val r = A.foldLeft(0L)((b, n) => b + LCM % n)
    println(r)
  }

}
