fun main(args: Array<String>) {
    val s = readLine()!!
    println(Math.min(f(s), f(s.reversed())))
}

private fun f(s: String): Int {
    if (s.length == 1) {
        return 0
    }

    var c = s[0]

    return s.substring(1).map {
        if (c == it) {
            c = if (c == '0') '1' else '0'
            1
        } else {
            c = it
            0
        }
    }.sum()
}