toInt :: (String -> Int)
toInt x = read x ::Int

getInts = do
  x <- getLine
  let y = (map$toInt)$words x
  return y

whichTileMin x = min ptnALen ptnBLen
  where ptnALen = length (filter (== False) (zipWith (==) x (cycle "01")))
        ptnBLen = length (filter (== False) (zipWith (==) x (cycle "10")))

main :: IO ()
main = do
  a <- getLine
  print $ whichTileMin a