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 res = ref 0 in
   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) ax.(0) ax in
  let m = l - 1 in
  for i = 0 to n-1 do
    res := (m mod ax.(i)) + !res
  done;
  Printf.printf "%d\n" !res
  

