import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val list: MutableList<Int> = mutableListOf()
    for (i in 1..5) {
        list.add(sc.nextInt())
    }
    for (i in 0..4){
        if(list.get(i) ==0){
            print(i+1)
        }
    }
}