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