import java.util.Scanner;
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		int num = 0;
		int ans = 0;
		for(int i = 1; i < 6; i++) {
			num = scan.nextInt();
			if(num == 0) {
				ans = i;
			}
		}
		System.out.println(ans);
		
		
	}

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

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		int num = 0;
		int ans = 0;
		for(int i = 1; i < 6; i++) {
			num = scan.nextInt();
			if(num == 0) {
				ans = i;
			}
		}
		System.out.println(ans);
		
		
	}

} Main /**
	 * @param args
	 */
	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		int num = 0;
		int ans = 0;
		for(int i = 1; i < 6; i++) {
			num = scan.nextInt();
			if(num == 0) {
				ans = i;
			}
		}
		System.out.println(ans);
		
		
	} main {
		
		Scanner scan = new Scanner(System.in);
		int num = 0;
		int ans = 0;
		for(int i = 1; i < 6; i++) {
			num = scan.nextInt();
			if(num == 0) {
				ans = i;
			}
		}
		System.out.println(ans);
		
		
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int num = 0; num 0 int ans = 0; ans 0 for(int i = 1; i < 6; i++) {
			num = scan.nextInt();
			if(num == 0) {
				ans = i;
			}
		} int i = 1; int i = 1; i 1 i < 6 i 6 i++ i++ i {
			num = scan.nextInt();
			if(num == 0) {
				ans = i;
			}
		} {
			num = scan.nextInt();
			if(num == 0) {
				ans = i;
			}
		} num = scan.nextInt() num scan.nextInt() scan.nextInt scan if(num == 0) {
				ans = i;
			} num == 0 num 0 {
				ans = i;
			} ans = i ans i System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		int num = 0;
		int ans = 0;
		for(int i = 1; i < 6; i++) {
			num = scan.nextInt();
			if(num == 0) {
				ans = i;
			}
		}
		System.out.println(ans);
		
		
	}

} public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		int num = 0;
		int ans = 0;
		for(int i = 1; i < 6; i++) {
			num = scan.nextInt();
			if(num == 0) {
				ans = i;
			}
		}
		System.out.println(ans);
		
		
	}

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

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		int num = 0;
		int ans = 0;
		for(int i = 1; i < 6; i++) {
			num = scan.nextInt();
			if(num == 0) {
				ans = i;
			}
		}
		System.out.println(ans);
		
		
	}

}
