let () = Scanf.scanf "%d\n" @@ fun n ->
  let as_ = Array.init n @@ fun _ ->
    Scanf.scanf "%d " @@ fun a -> a in
  Array.fold_left (fun (prev, (acc, curr)) a ->
    a,
    if a = prev then (acc, curr + 1)
    else (curr :: acc, 1)) (max_int, ([], 1)) as_
  |> (fun (_, (acc, curr)) -> curr :: acc)
  |> List.map (fun i -> i / 2)
  |> List.fold_left ( + ) 0
  |> Printf.printf "%d\n"
