// JavaScript source code
"use strict";

function main(input) {
    input = input.split(" ");
    for (let i = 0; i < 5; i++) {
        if (input[i] == 0) {
            console.log(i + 1);
            break;
        }
    }
};

main(require("fs").readFileSync("/dev/stdin", "utf8"));