let () =
  let n = Scanf.scanf "%d\n" (fun n -> n) in
  let as_ = Array.init n (fun _ -> Scanf.scanf "%d\n" (fun a -> a)) in
  Array.to_list as_
  |> (fun (a :: as_) -> List.fold_left (fun (acc, prev) a ->
      (acc + min prev a + (prev - min prev a) / 2, a - min prev a)) (0, a) as_)
  |> fst
  |> Printf.printf "%d\n"