let count s b =
  let rec count' s i b cnt =
    if i >= String.length s then cnt
    else if b = (s.[i] = '0') then count' s (i + 1) (not b) cnt
    else count' s (i + 1) (not b) (cnt + 1) in
  count' s 0 b 0
;;

let () = Scanf.scanf "%s" (fun s -> 
  min (count s true) (count s false) |> print_int
);;