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

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

    }
} Main public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int X[]=new int[6];
    	int ans=0;
    	for(int i=1;i<=5;i++){
    		X[i]=sc.nextInt();
    	}
    	for(int j=1;j<=5;j++){
    		if (X[j]==0) {
    			ans=j;
    		}
    	}
		System.out.println(ans);
		//System.out.print(ans);
		

    } main {
    	Scanner sc = new Scanner(System.in);
    	int X[]=new int[6];
    	int ans=0;
    	for(int i=1;i<=5;i++){
    		X[i]=sc.nextInt();
    	}
    	for(int j=1;j<=5;j++){
    		if (X[j]==0) {
    			ans=j;
    		}
    	}
		System.out.println(ans);
		//System.out.print(ans);
		

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int X[]=new int[6]; X new int[6] 6 int ans=0; ans 0 for(int i=1;i<=5;i++){
    		X[i]=sc.nextInt();
    	} int i=1; int i=1; i 1 i<=5 i 5 i++ i++ i {
    		X[i]=sc.nextInt();
    	} {
    		X[i]=sc.nextInt();
    	} X[i]=sc.nextInt() X[i] X i sc.nextInt() sc.nextInt sc for(int j=1;j<=5;j++){
    		if (X[j]==0) {
    			ans=j;
    		}
    	} int j=1; int j=1; j 1 j<=5 j 5 j++ j++ j {
    		if (X[j]==0) {
    			ans=j;
    		}
    	} {
    		if (X[j]==0) {
    			ans=j;
    		}
    	} if (X[j]==0) {
    			ans=j;
    		} X[j]==0 X[j] X j 0 {
    			ans=j;
    		} ans=j ans j System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int X[]=new int[6];
    	int ans=0;
    	for(int i=1;i<=5;i++){
    		X[i]=sc.nextInt();
    	}
    	for(int j=1;j<=5;j++){
    		if (X[j]==0) {
    			ans=j;
    		}
    	}
		System.out.println(ans);
		//System.out.print(ans);
		

    }
} public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int X[]=new int[6];
    	int ans=0;
    	for(int i=1;i<=5;i++){
    		X[i]=sc.nextInt();
    	}
    	for(int j=1;j<=5;j++){
    		if (X[j]==0) {
    			ans=j;
    		}
    	}
		System.out.println(ans);
		//System.out.print(ans);
		

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

    }
}