import java.io.*;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner inputs = new Scanner(System.in);
		int loo = 0;
		while(loo++<6) {
			if(inputs.nextInt()==0) {
				System.out.println(loo);
				break;
			}
		}
	}

} import java.io.*; io.* java import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner inputs = new Scanner(System.in);
		int loo = 0;
		while(loo++<6) {
			if(inputs.nextInt()==0) {
				System.out.println(loo);
				break;
			}
		}
	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner inputs = new Scanner(System.in);
		int loo = 0;
		while(loo++<6) {
			if(inputs.nextInt()==0) {
				System.out.println(loo);
				break;
			}
		}
	} main {
		// TODO Auto-generated method stub
		Scanner inputs = new Scanner(System.in);
		int loo = 0;
		while(loo++<6) {
			if(inputs.nextInt()==0) {
				System.out.println(loo);
				break;
			}
		}
	} Scanner inputs = new Scanner(System.in); inputs new Scanner(System.in) int loo = 0; loo 0 while(loo++<6) {
			if(inputs.nextInt()==0) {
				System.out.println(loo);
				break;
			}
		} loo++<6 loo++ loo 6 {
			if(inputs.nextInt()==0) {
				System.out.println(loo);
				break;
			}
		} if(inputs.nextInt()==0) {
				System.out.println(loo);
				break;
			} inputs.nextInt()==0 inputs.nextInt() inputs.nextInt inputs 0 {
				System.out.println(loo);
				break;
			} System.out.println(loo) System.out.println System.out System System.out loo break; String[] args args public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner inputs = new Scanner(System.in);
		int loo = 0;
		while(loo++<6) {
			if(inputs.nextInt()==0) {
				System.out.println(loo);
				break;
			}
		}
	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner inputs = new Scanner(System.in);
		int loo = 0;
		while(loo++<6) {
			if(inputs.nextInt()==0) {
				System.out.println(loo);
				break;
			}
		}
	}

} Main
import java.io.*;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner inputs = new Scanner(System.in);
		int loo = 0;
		while(loo++<6) {
			if(inputs.nextInt()==0) {
				System.out.println(loo);
				break;
			}
		}
	}

}
