import Data.Bool

main = print . solve =<< getLine

solve :: String -> Int
solve s = min (ob+ew) (ow+eb)
    where
        (ob, ow) = cnt s
        (eb, ew) = cnt $ drop 1 s

cnt ('0':ss) = incblack . cnt $ drop 1 ss
cnt ('1':ss) = incwhite . cnt $ drop 1 ss
cnt [] = (0, 0)

incblack (b, w) = (b+1, w)
incwhite (b, w) = (b, w+1)
