const main = stdin => {
  const input = stdin.trim().split(' ')
  for (let i = 0; i < 5; i++) {
    if (input[i] === '0') {
      console.log(i + 1)
      return
    }
  }
}


// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))
