import java.util.Scanner

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val s = sc.next()
    val bools = s.map { it == '1' }
    val resultTrue = search(bools, true)
    val resultFalse = search(bools, false)
    if (resultTrue < resultFalse) {
        println(resultTrue)
    } else {
        println(resultFalse)
    }
}

private fun search(bools: List<Boolean>, first: Boolean): Int {
    var count: Int = 0
    bools.fold(first) { acc, b ->
        if (acc == b) {
            count++
            !b
        } else {
            b
        }
    }
    return count
}