import java.lang.Integer

object Main extends App {
  
  val sc = new java.util.Scanner(System.in)
  val _s = sc.next()
  val s = Integer.parseInt(_s, 2)
  val p1 = Integer.parseInt(gen('1', _s.length, ""), 2)
  val p2 = Integer.parseInt(gen('0', _s.length, ""), 2)
  val a1 = Integer.bitCount(s ^ p1)
  val a2 = Integer.bitCount(s ^ p2)
  println(a1.min(a2))

  // 交互の文字列を生成する関数
  def gen(a: Char, length: Int, acc: String): String = {
    if (acc.length == length) {
      acc
    } else {
      gen(if(a == '1') '0' else '1', length, acc + a)
    }
  }
}