import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val n = sc.nextInt
  val as = Vector.fill(n)(BigInt(sc.nextInt))
  val lcm = as.foldLeft(BigInt(1)) { (acc, next) =>
    acc * next / acc.gcd(next)
  }

  def f(m: BigInt): BigInt =
    as.foldLeft(BigInt(0)) { (acc, next) => acc + (m % next) }

  println(f(lcm - 1))
}
