let readString() = stdin.ReadLine()
let readStringArray() = stdin.ReadLine().Split(' ');
let readInt() = readString() |> int
let readIntArray() = readStringArray() |> Array.map(fun x -> int x)
let char2String(value) = List.ofSeq value |> List.toArray |> System.String

let s = readString().ToCharArray() |> List.ofArray

let next c = if c = '0' then '1' else '0'

let rec solve str c = 
    match str with
    | h::t -> if h = c then (solve t (next c)) + 1  else solve t (next c)
    | _ -> 0

min (solve s '0') (solve s '1') 
|> printfn "%d"