let rec gcd a b =
  if b = 0 then a else gcd b (a mod b)
let rec lcm a b =
  a * b / gcd a b
let () =
    let n = Scanf.scanf "%d\n" (fun x -> x) in
  let ax = Array.init n (fun _ ->
               Scanf.scanf " %d" (fun x -> x)) in
  let l = Array.fold_left (lcm) 1 ax in
  let m = (if l = 1 then 1 else  l - 1) in
  let res = Array.fold_left (fun res x ->
                res + (m mod x)
              ) 0 ax in
  
  Printf.printf "%d\n" res
  

