let solve = Array.fold_left (fun ((c, c'), n) d ->
  (c', c), n + if c = d then 1 else 0)

let () =
  let s = read_line () in
  let s = Array.init (String.length s) (String.get s) in
  Printf.printf "%d\n" @@ min
    (snd @@ solve (('0', '1'), 0) s)
    (snd @@ solve (('1', '0'), 0) s)