module Main where

main :: IO ()
main = input >>= output


input :: IO [Char]
input = getLine

output :: [Char] -> IO ()
output s = output' (length s) 0 '0' '1' s
    where
        output' l i _ _ [] = print $ min i $ l - i
        output' l i c cl (x:xs)
            | c == x = output' l (i+1) cl c xs
            | otherwise = output' l i cl c xs
