fun main(args : Array<String>) {
  readLine()
  readLine()!!.split(" ").map { it.toLong() }.sortedDescending().run {
    var n = 1L
    forEach { if (n % it != 0L) n *= it }
    print(map { (n - 1) % it }.sum())
  }
}