import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a;
		int box = 0;
		
		for(int i = 1;i<6;i++) {
			a = scan.nextInt();
			if(a==0) {
				box = i;
			}
		}
		System.out.print(box);
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a;
		int box = 0;
		
		for(int i = 1;i<6;i++) {
			a = scan.nextInt();
			if(a==0) {
				box = i;
			}
		}
		System.out.print(box);
	}

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

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a;
		int box = 0;
		
		for(int i = 1;i<6;i++) {
			a = scan.nextInt();
			if(a==0) {
				box = i;
			}
		}
		System.out.print(box);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a;
		int box = 0;
		
		for(int i = 1;i<6;i++) {
			a = scan.nextInt();
			if(a==0) {
				box = i;
			}
		}
		System.out.print(box);
	}

} Main
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a;
		int box = 0;
		
		for(int i = 1;i<6;i++) {
			a = scan.nextInt();
			if(a==0) {
				box = i;
			}
		}
		System.out.print(box);
	}

}