"use strict";

const isUpperCase = str => {
    return str === str.toUpperCase() ? true : false;
}

const main = (input) => {
    const spi = input.split('\n');
    const x = spi[0].split(' ').map(e => parseInt(e));

    for (let i = 0; i < 5; i++) {
        if (x[i] === 0) {
            console.log(i + 1);
            return;
        }
    }
};

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