import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
			Scanner cin=new Scanner(System.in);
			int q[]=new int[100];
			for(int i=1;i<=5;++i)q[i]=cin.nextInt();
			for(int i=1;i<=5;++i) {
				if(q[i]==0) {
					System.out.println(i);
					break;
				}
			}
	}
} import java.math.BigInteger; BigInteger java.math import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
			Scanner cin=new Scanner(System.in);
			int q[]=new int[100];
			for(int i=1;i<=5;++i)q[i]=cin.nextInt();
			for(int i=1;i<=5;++i) {
				if(q[i]==0) {
					System.out.println(i);
					break;
				}
			}
	}
} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
			Scanner cin=new Scanner(System.in);
			int q[]=new int[100];
			for(int i=1;i<=5;++i)q[i]=cin.nextInt();
			for(int i=1;i<=5;++i) {
				if(q[i]==0) {
					System.out.println(i);
					break;
				}
			}
	} main {
		// TODO Auto-generated method stub
			Scanner cin=new Scanner(System.in);
			int q[]=new int[100];
			for(int i=1;i<=5;++i)q[i]=cin.nextInt();
			for(int i=1;i<=5;++i) {
				if(q[i]==0) {
					System.out.println(i);
					break;
				}
			}
	} Scanner cin=new Scanner(System.in); cin new Scanner(System.in) int q[]=new int[100]; q new int[100] 100 for(int i=1;i<=5;++i)q[i]=cin.nextInt(); int i=1; int i=1; i 1 i<=5 i 5 ++i ++i i q[i]=cin.nextInt(); q[i]=cin.nextInt() q[i] q i cin.nextInt() cin.nextInt cin for(int i=1;i<=5;++i) {
				if(q[i]==0) {
					System.out.println(i);
					break;
				}
			} int i=1; int i=1; i 1 i<=5 i 5 ++i ++i i {
				if(q[i]==0) {
					System.out.println(i);
					break;
				}
			} {
				if(q[i]==0) {
					System.out.println(i);
					break;
				}
			} if(q[i]==0) {
					System.out.println(i);
					break;
				} q[i]==0 q[i] q i 0 {
					System.out.println(i);
					break;
				} System.out.println(i) System.out.println System.out System System.out i break; String[] args args public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
			Scanner cin=new Scanner(System.in);
			int q[]=new int[100];
			for(int i=1;i<=5;++i)q[i]=cin.nextInt();
			for(int i=1;i<=5;++i) {
				if(q[i]==0) {
					System.out.println(i);
					break;
				}
			}
	}
} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
			Scanner cin=new Scanner(System.in);
			int q[]=new int[100];
			for(int i=1;i<=5;++i)q[i]=cin.nextInt();
			for(int i=1;i<=5;++i) {
				if(q[i]==0) {
					System.out.println(i);
					break;
				}
			}
	}
} Main
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
			Scanner cin=new Scanner(System.in);
			int q[]=new int[100];
			for(int i=1;i<=5;++i)q[i]=cin.nextInt();
			for(int i=1;i<=5;++i) {
				if(q[i]==0) {
					System.out.println(i);
					break;
				}
			}
	}
}
