import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		
		Scanner scanner = new Scanner(System.in);
		
		List<String> list = new ArrayList<>();
		
		for (int i = 0; i < 5; i++) {
			
			list.add(scanner.next());
		}
		
		scanner.close();
		
		int result = list.indexOf("0");
		
			
		System.out.println(result + 1);
	}

} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
	
	public static void main(String[] args) {
		
		Scanner scanner = new Scanner(System.in);
		
		List<String> list = new ArrayList<>();
		
		for (int i = 0; i < 5; i++) {
			
			list.add(scanner.next());
		}
		
		scanner.close();
		
		int result = list.indexOf("0");
		
			
		System.out.println(result + 1);
	}

} Main public static void main(String[] args) {
		
		Scanner scanner = new Scanner(System.in);
		
		List<String> list = new ArrayList<>();
		
		for (int i = 0; i < 5; i++) {
			
			list.add(scanner.next());
		}
		
		scanner.close();
		
		int result = list.indexOf("0");
		
			
		System.out.println(result + 1);
	} main {
		
		Scanner scanner = new Scanner(System.in);
		
		List<String> list = new ArrayList<>();
		
		for (int i = 0; i < 5; i++) {
			
			list.add(scanner.next());
		}
		
		scanner.close();
		
		int result = list.indexOf("0");
		
			
		System.out.println(result + 1);
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) List<String> list = new ArrayList<>(); list new ArrayList<>() for (int i = 0; i < 5; i++) {
			
			list.add(scanner.next());
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			
			list.add(scanner.next());
		} {
			
			list.add(scanner.next());
		} list.add(scanner.next()) list.add list scanner.next() scanner.next scanner scanner.close() scanner.close scanner int result = list.indexOf("0"); result list.indexOf("0") list.indexOf list "0" System.out.println(result + 1) System.out.println System.out System System.out result + 1 result 1 String[] args args public class Main {
	
	public static void main(String[] args) {
		
		Scanner scanner = new Scanner(System.in);
		
		List<String> list = new ArrayList<>();
		
		for (int i = 0; i < 5; i++) {
			
			list.add(scanner.next());
		}
		
		scanner.close();
		
		int result = list.indexOf("0");
		
			
		System.out.println(result + 1);
	}

} public class Main {
	
	public static void main(String[] args) {
		
		Scanner scanner = new Scanner(System.in);
		
		List<String> list = new ArrayList<>();
		
		for (int i = 0; i < 5; i++) {
			
			list.add(scanner.next());
		}
		
		scanner.close();
		
		int result = list.indexOf("0");
		
			
		System.out.println(result + 1);
	}

} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		
		Scanner scanner = new Scanner(System.in);
		
		List<String> list = new ArrayList<>();
		
		for (int i = 0; i < 5; i++) {
			
			list.add(scanner.next());
		}
		
		scanner.close();
		
		int result = list.indexOf("0");
		
			
		System.out.println(result + 1);
	}

}
