Scanf.scanf "%d" @@ fun n ->
  Array.init n (fun _ -> Scanf.scanf " %d" ((+) 0))
  |> Array.fold_left (fun (s, l) x ->
      let c = if x = 0 then 0 else l + x mod 2 in
      s + x/2 + c/2, c mod 2) (0, 0)
  |> fst |> Printf.printf "%d\n"