import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		for (int i = 0; i < 5; i++) {
			if (sc.nextInt() == 0) {
				System.out.print(i + 1);
				break;
			}
		}
		sc.close();
	}

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

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		for (int i = 0; i < 5; i++) {
			if (sc.nextInt() == 0) {
				System.out.print(i + 1);
				break;
			}
		}
		sc.close();
	}

} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		for (int i = 0; i < 5; i++) {
			if (sc.nextInt() == 0) {
				System.out.print(i + 1);
				break;
			}
		}
		sc.close();
	} main {

		Scanner sc = new Scanner(System.in);

		for (int i = 0; i < 5; i++) {
			if (sc.nextInt() == 0) {
				System.out.print(i + 1);
				break;
			}
		}
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) for (int i = 0; i < 5; i++) {
			if (sc.nextInt() == 0) {
				System.out.print(i + 1);
				break;
			}
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			if (sc.nextInt() == 0) {
				System.out.print(i + 1);
				break;
			}
		} {
			if (sc.nextInt() == 0) {
				System.out.print(i + 1);
				break;
			}
		} if (sc.nextInt() == 0) {
				System.out.print(i + 1);
				break;
			} sc.nextInt() == 0 sc.nextInt() sc.nextInt sc 0 {
				System.out.print(i + 1);
				break;
			} System.out.print(i + 1) System.out.print System.out System System.out i + 1 i 1 break; sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		for (int i = 0; i < 5; i++) {
			if (sc.nextInt() == 0) {
				System.out.print(i + 1);
				break;
			}
		}
		sc.close();
	}

} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		for (int i = 0; i < 5; i++) {
			if (sc.nextInt() == 0) {
				System.out.print(i + 1);
				break;
			}
		}
		sc.close();
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		for (int i = 0; i < 5; i++) {
			if (sc.nextInt() == 0) {
				System.out.print(i + 1);
				break;
			}
		}
		sc.close();
	}

}
