let s = stdin.ReadLine()

let paturn1 = [|0..s.Length-1|] |> Array.mapi (fun i x -> if i%2=0 then "0" else "1") |> Array.reduce (fun acc next -> acc + next)
let paturn2 = [|0..s.Length-1|] |> Array.mapi (fun i x -> if i%2=0 then "1" else "0") |> Array.reduce (fun acc next -> acc + next)

let compare (paturn:string) =
    s.ToCharArray() |> Seq.zip (paturn.ToCharArray()) |> Seq.fold (fun count (x,y) ->if x=y then count+1 else count ) 0

min (compare paturn1) (compare paturn2) |> stdout.WriteLine