fun main() {
    val arr = readLine()?.split(" ")?.map { Integer.parseInt(it) } ?: return
    for (i in 0..4) {
        if (arr[i] == 0) {
            println(i+1)
            return
        }
    }
}