import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);int j;
    for(int i=0;i<=4;i++){
       j =sc.nextInt();
      if(j==0){System.out.println(i+1);System.exit(0);}
    }
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);int j;
    for(int i=0;i<=4;i++){
       j =sc.nextInt();
      if(j==0){System.out.println(i+1);System.exit(0);}
    }
  }
} Main public static void main(String[] args){
    Scanner sc =new Scanner(System.in);int j;
    for(int i=0;i<=4;i++){
       j =sc.nextInt();
      if(j==0){System.out.println(i+1);System.exit(0);}
    }
  } main {
    Scanner sc =new Scanner(System.in);int j;
    for(int i=0;i<=4;i++){
       j =sc.nextInt();
      if(j==0){System.out.println(i+1);System.exit(0);}
    }
  } Scanner sc =new Scanner(System.in); sc new Scanner(System.in) int j; j for(int i=0;i<=4;i++){
       j =sc.nextInt();
      if(j==0){System.out.println(i+1);System.exit(0);}
    } int i=0; int i=0; i 0 i<=4 i 4 i++ i++ i {
       j =sc.nextInt();
      if(j==0){System.out.println(i+1);System.exit(0);}
    } {
       j =sc.nextInt();
      if(j==0){System.out.println(i+1);System.exit(0);}
    } j =sc.nextInt() j sc.nextInt() sc.nextInt sc if(j==0){System.out.println(i+1);System.exit(0);} j==0 j 0 {System.out.println(i+1);System.exit(0);} System.out.println(i+1) System.out.println System.out System System.out i+1 i 1 System.exit(0) System.exit System 0 String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);int j;
    for(int i=0;i<=4;i++){
       j =sc.nextInt();
      if(j==0){System.out.println(i+1);System.exit(0);}
    }
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);int j;
    for(int i=0;i<=4;i++){
       j =sc.nextInt();
      if(j==0){System.out.println(i+1);System.exit(0);}
    }
  }
} Main
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);int j;
    for(int i=0;i<=4;i++){
       j =sc.nextInt();
      if(j==0){System.out.println(i+1);System.exit(0);}
    }
  }
}