function Main(input) {
input = input.split("\n");
x = input[0].split(" ");

for (var i = 0; i < 5; i++) {
 if  (x[i] == 0) {
  var result = i + 1;
   break;
 } else {
 }
 };


console.log(result);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));