import java.util.Scanner;
import java.util.*;

public class Main {
        public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
		int ans = 0;
		for(int i = 0; i < 5; i++){

		int n = scan.nextInt();
		if(n == 0){
			ans = i + 1;
		}
		}

                System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util import java.util.*; util.* java public class Main {
        public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
		int ans = 0;
		for(int i = 0; i < 5; i++){

		int n = scan.nextInt();
		if(n == 0){
			ans = i + 1;
		}
		}

                System.out.println(ans);
    }
} Main public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
		int ans = 0;
		for(int i = 0; i < 5; i++){

		int n = scan.nextInt();
		if(n == 0){
			ans = i + 1;
		}
		}

                System.out.println(ans);
    } main {
                Scanner scan = new Scanner(System.in);
		int ans = 0;
		for(int i = 0; i < 5; i++){

		int n = scan.nextInt();
		if(n == 0){
			ans = i + 1;
		}
		}

                System.out.println(ans);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int ans = 0; ans 0 for(int i = 0; i < 5; i++){

		int n = scan.nextInt();
		if(n == 0){
			ans = i + 1;
		}
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {

		int n = scan.nextInt();
		if(n == 0){
			ans = i + 1;
		}
		} {

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

		int n = scan.nextInt();
		if(n == 0){
			ans = i + 1;
		}
		}

                System.out.println(ans);
    }
} public class Main {
        public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
		int ans = 0;
		for(int i = 0; i < 5; i++){

		int n = scan.nextInt();
		if(n == 0){
			ans = i + 1;
		}
		}

                System.out.println(ans);
    }
} Main
import java.util.Scanner;
import java.util.*;

public class Main {
        public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
		int ans = 0;
		for(int i = 0; i < 5; i++){

		int n = scan.nextInt();
		if(n == 0){
			ans = i + 1;
		}
		}

                System.out.println(ans);
    }
}
