import java.util.Scanner;

public class Main {

	static final long DIVIDE_NUMBER = 1000000007;

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int answer = 0;

		for (int i = 1; i < 6; i++) {

			int target = scan.nextInt();

			if (target == 0) {

				answer = i;
			}
		}

		println(answer);
	}

	public static void println(Object target) {
		System.out.println(target);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	static final long DIVIDE_NUMBER = 1000000007;

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int answer = 0;

		for (int i = 1; i < 6; i++) {

			int target = scan.nextInt();

			if (target == 0) {

				answer = i;
			}
		}

		println(answer);
	}

	public static void println(Object target) {
		System.out.println(target);
	}
} Main static final long DIVIDE_NUMBER = 1000000007; DIVIDE_NUMBER 1000000007 public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int answer = 0;

		for (int i = 1; i < 6; i++) {

			int target = scan.nextInt();

			if (target == 0) {

				answer = i;
			}
		}

		println(answer);
	} main {

		Scanner scan = new Scanner(System.in);

		int answer = 0;

		for (int i = 1; i < 6; i++) {

			int target = scan.nextInt();

			if (target == 0) {

				answer = i;
			}
		}

		println(answer);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int answer = 0; answer 0 for (int i = 1; i < 6; i++) {

			int target = scan.nextInt();

			if (target == 0) {

				answer = i;
			}
		} int i = 1; int i = 1; i 1 i < 6 i 6 i++ i++ i {

			int target = scan.nextInt();

			if (target == 0) {

				answer = i;
			}
		} {

			int target = scan.nextInt();

			if (target == 0) {

				answer = i;
			}
		} int target = scan.nextInt(); target scan.nextInt() scan.nextInt scan if (target == 0) {

				answer = i;
			} target == 0 target 0 {

				answer = i;
			} answer = i answer i println(answer) println answer String[] args args public static void println(Object target) {
		System.out.println(target);
	} println {
		System.out.println(target);
	} System.out.println(target) System.out.println System.out System System.out target Object target target public class Main {

	static final long DIVIDE_NUMBER = 1000000007;

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int answer = 0;

		for (int i = 1; i < 6; i++) {

			int target = scan.nextInt();

			if (target == 0) {

				answer = i;
			}
		}

		println(answer);
	}

	public static void println(Object target) {
		System.out.println(target);
	}
} public class Main {

	static final long DIVIDE_NUMBER = 1000000007;

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int answer = 0;

		for (int i = 1; i < 6; i++) {

			int target = scan.nextInt();

			if (target == 0) {

				answer = i;
			}
		}

		println(answer);
	}

	public static void println(Object target) {
		System.out.println(target);
	}
} Main
import java.util.Scanner;

public class Main {

	static final long DIVIDE_NUMBER = 1000000007;

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int answer = 0;

		for (int i = 1; i < 6; i++) {

			int target = scan.nextInt();

			if (target == 0) {

				answer = i;
			}
		}

		println(answer);
	}

	public static void println(Object target) {
		System.out.println(target);
	}
}
