"use strict";

const main = (input) =>{
  
  let arr = input.trim().split(" ");
  
  if(arr[0] =="0") console.log("1");
  if(arr[1] =="0") console.log("2");
  if(arr[2] =="0") console.log("3");
  if(arr[3] =="0") console.log("4");
  if(arr[4] =="0") console.log("5");
 
};

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