--{-# LANGUAGE OverloadedStrings #-}
--{-# LANGUAGE OverloadedLists   #-}
{-# LANGUAGE BangPatterns      #-} --引数に!
{-# LANGUAGE MultiWayIf        #-}
{-# LANGUAGE TupleSections     #-}

import Data.Bits
import Data.Foldable (foldlM,foldrM)
import Data.Maybe (fromJust)
import Data.List
import Data.Array  --変数衝突
import Data.Array.Unboxed
import Data.Array.MArray
import Data.Array.ST
import qualified Data.Vector.Unboxed as V
import Control.Monad
import Control.Monad.State
import Control.Monad.ST
import qualified Data.ByteString.Lazy.Char8 as B
import Debug.Trace

cnt :: String -> String -> Int
cnt [] _ = 0
cnt (s:ss) (t:ts) = if s == t then 1+(cnt ss ts) else cnt ss ts

main :: IO ()
main = do
  s <- getLine
  let n = (length s)
  print $ min (cnt s $ take n (cycle "01")) (cnt s $ take n (cycle "10"))
