main :: IO ()
main = do
  s <- getLine
  print $ min (f p01 s) (f p10 s)

f :: String -> String -> Int
f xs ys = length . filter (== False) $ zipWith (==) xs ys

p01 :: String
p01 = cycle "01"

p10 :: String
p10 = cycle "10"
