import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		for(int i=1; i<=5;i++) {
			if(Integer.parseInt(sc.next()) == 0) {
				System.out.println(i);
				return;
			}
		}
	}
} import java.util.Scanner; Scanner java.util class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		for(int i=1; i<=5;i++) {
			if(Integer.parseInt(sc.next()) == 0) {
				System.out.println(i);
				return;
			}
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		for(int i=1; i<=5;i++) {
			if(Integer.parseInt(sc.next()) == 0) {
				System.out.println(i);
				return;
			}
		}
	} main {
		Scanner sc = new Scanner(System.in);
		for(int i=1; i<=5;i++) {
			if(Integer.parseInt(sc.next()) == 0) {
				System.out.println(i);
				return;
			}
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) for(int i=1; i<=5;i++) {
			if(Integer.parseInt(sc.next()) == 0) {
				System.out.println(i);
				return;
			}
		} int i=1; int i=1; i 1 i<=5 i 5 i++ i++ i {
			if(Integer.parseInt(sc.next()) == 0) {
				System.out.println(i);
				return;
			}
		} {
			if(Integer.parseInt(sc.next()) == 0) {
				System.out.println(i);
				return;
			}
		} if(Integer.parseInt(sc.next()) == 0) {
				System.out.println(i);
				return;
			} Integer.parseInt(sc.next()) == 0 Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc 0 {
				System.out.println(i);
				return;
			} System.out.println(i) System.out.println System.out System System.out i return; String[] args args
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		for(int i=1; i<=5;i++) {
			if(Integer.parseInt(sc.next()) == 0) {
				System.out.println(i);
				return;
			}
		}
	}
}
