import           Data.Function (on)

main :: IO ()
main = print . solve . map fromChar =<< getLine

data Tile =
  Black | White
  deriving (Eq)

fromChar :: Char -> Tile
fromChar '0' = Black
fromChar '1' = White
fromChar _   = undefined

solve :: [Tile] -> Int
-- solve tiles = min (length $ filter not $ zipWith (==) goal1 tiles) (length $ filter not $ zipWith (==) goal2 tiles)
solve tiles = (min `on` (\goal -> length $ filter not $ zipWith (==) goal tiles)) goal1 goal2

goal1, goal2 :: [Tile]
goal1 = cycle [Black, White]
goal2 = cycle [White, Black]
