import scala.io.StdIn
import scala.math._

object Main {

  def convert(c: Char): Boolean = if (c == '1') true else false

  type State = Tuple2[Int, Boolean]

  def main(args: Array[String]): Unit = {
    val s = StdIn.readLine.toList.map(convert)

    val res = s.foldLeft((0, true))((state, b) => if (state._2 ^ b) (state._1 + 1, !state._2) else (state._1, !state._2))

    println(if (res._1 > s.size - res._1) s.size - res._1 else res._1)

  }
}