import Data.Char

main :: IO ()
main = getLine >>= print . solve

solve :: String -> Int
solve s = min (calc wb) (calc bw)
  where
    ints = map digitToInt s :: [Int]
    wb = cycle [1, 0]
    bw = cycle [0, 1]
    calc = sum . map abs . zipWith (-) ints