import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val x = (1..5).map { sc.nextInt() }

  var index = 1
  for (i in x) {
    if (i == 0) {
      println(index)
      return
    }
    index++
  }

}
