import java.util.Scanner;


public class Main {
	public static void main (String args[]) throws Exception{
		Scanner scan = new Scanner(System.in);

		for(int i = 1; i < 6; i++) {
			int x = scan.nextInt();
				if(x == 0) {
					System.out.println(i);
					break;
				}
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main (String args[]) throws Exception{
		Scanner scan = new Scanner(System.in);

		for(int i = 1; i < 6; i++) {
			int x = scan.nextInt();
				if(x == 0) {
					System.out.println(i);
					break;
				}
		}
	}
} Main public static void main (String args[]) throws Exception{
		Scanner scan = new Scanner(System.in);

		for(int i = 1; i < 6; i++) {
			int x = scan.nextInt();
				if(x == 0) {
					System.out.println(i);
					break;
				}
		}
	} main {
		Scanner scan = new Scanner(System.in);

		for(int i = 1; i < 6; i++) {
			int x = scan.nextInt();
				if(x == 0) {
					System.out.println(i);
					break;
				}
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) for(int i = 1; i < 6; i++) {
			int x = scan.nextInt();
				if(x == 0) {
					System.out.println(i);
					break;
				}
		} int i = 1; int i = 1; i 1 i < 6 i 6 i++ i++ i {
			int x = scan.nextInt();
				if(x == 0) {
					System.out.println(i);
					break;
				}
		} {
			int x = scan.nextInt();
				if(x == 0) {
					System.out.println(i);
					break;
				}
		} int x = scan.nextInt(); x scan.nextInt() scan.nextInt scan if(x == 0) {
					System.out.println(i);
					break;
				} x == 0 x 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[]) throws Exception{
		Scanner scan = new Scanner(System.in);

		for(int i = 1; i < 6; i++) {
			int x = scan.nextInt();
				if(x == 0) {
					System.out.println(i);
					break;
				}
		}
	}
} public class Main {
	public static void main (String args[]) throws Exception{
		Scanner scan = new Scanner(System.in);

		for(int i = 1; i < 6; i++) {
			int x = scan.nextInt();
				if(x == 0) {
					System.out.println(i);
					break;
				}
		}
	}
} Main
import java.util.Scanner;


public class Main {
	public static void main (String args[]) throws Exception{
		Scanner scan = new Scanner(System.in);

		for(int i = 1; i < 6; i++) {
			int x = scan.nextInt();
				if(x == 0) {
					System.out.println(i);
					break;
				}
		}
	}
}