fun main(args: Array<String>) {
    val line = readLine()!!.split(" ")

    fun countIndex(num: List<String>, counter: Int = 1): Int {
        return if (num[0] == "0") counter else countIndex(num.takeLast(num.size - 1), counter + 1)
    }
    println(countIndex(line))
}
