import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception{
		Scanner scanner = new Scanner(System.in);
		int input1 = Integer.parseInt(scanner.next());
		int input2 = Integer.parseInt(scanner.next());
		int input3 = Integer.parseInt(scanner.next());
		int input4 = Integer.parseInt(scanner.next());
		int input5 = Integer.parseInt(scanner.next());
		
		if(input1 ==0) {
			System.out.println("1");
		}else if(input2 == 0) {
			System.out.println("2");
		}else if(input3 == 0) {
			System.out.println("3");
		}else if(input4 == 0) {
			System.out.println("4");
		}else if(input5 == 0) {
			System.out.println("5");
		}
		scanner.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) throws Exception{
		Scanner scanner = new Scanner(System.in);
		int input1 = Integer.parseInt(scanner.next());
		int input2 = Integer.parseInt(scanner.next());
		int input3 = Integer.parseInt(scanner.next());
		int input4 = Integer.parseInt(scanner.next());
		int input5 = Integer.parseInt(scanner.next());
		
		if(input1 ==0) {
			System.out.println("1");
		}else if(input2 == 0) {
			System.out.println("2");
		}else if(input3 == 0) {
			System.out.println("3");
		}else if(input4 == 0) {
			System.out.println("4");
		}else if(input5 == 0) {
			System.out.println("5");
		}
		scanner.close();
	}
} Main public static void main(String[] args) throws Exception{
		Scanner scanner = new Scanner(System.in);
		int input1 = Integer.parseInt(scanner.next());
		int input2 = Integer.parseInt(scanner.next());
		int input3 = Integer.parseInt(scanner.next());
		int input4 = Integer.parseInt(scanner.next());
		int input5 = Integer.parseInt(scanner.next());
		
		if(input1 ==0) {
			System.out.println("1");
		}else if(input2 == 0) {
			System.out.println("2");
		}else if(input3 == 0) {
			System.out.println("3");
		}else if(input4 == 0) {
			System.out.println("4");
		}else if(input5 == 0) {
			System.out.println("5");
		}
		scanner.close();
	} main {
		Scanner scanner = new Scanner(System.in);
		int input1 = Integer.parseInt(scanner.next());
		int input2 = Integer.parseInt(scanner.next());
		int input3 = Integer.parseInt(scanner.next());
		int input4 = Integer.parseInt(scanner.next());
		int input5 = Integer.parseInt(scanner.next());
		
		if(input1 ==0) {
			System.out.println("1");
		}else if(input2 == 0) {
			System.out.println("2");
		}else if(input3 == 0) {
			System.out.println("3");
		}else if(input4 == 0) {
			System.out.println("4");
		}else if(input5 == 0) {
			System.out.println("5");
		}
		scanner.close();
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int input1 = Integer.parseInt(scanner.next()); input1 Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner int input2 = Integer.parseInt(scanner.next()); input2 Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner int input3 = Integer.parseInt(scanner.next()); input3 Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner int input4 = Integer.parseInt(scanner.next()); input4 Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner int input5 = Integer.parseInt(scanner.next()); input5 Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner if(input1 ==0) {
			System.out.println("1");
		}else if(input2 == 0) {
			System.out.println("2");
		}else if(input3 == 0) {
			System.out.println("3");
		}else if(input4 == 0) {
			System.out.println("4");
		}else if(input5 == 0) {
			System.out.println("5");
		} input1 ==0 input1 0 {
			System.out.println("1");
		} System.out.println("1") System.out.println System.out System System.out "1" if(input2 == 0) {
			System.out.println("2");
		}else if(input3 == 0) {
			System.out.println("3");
		}else if(input4 == 0) {
			System.out.println("4");
		}else if(input5 == 0) {
			System.out.println("5");
		} input2 == 0 input2 0 {
			System.out.println("2");
		} System.out.println("2") System.out.println System.out System System.out "2" if(input3 == 0) {
			System.out.println("3");
		}else if(input4 == 0) {
			System.out.println("4");
		}else if(input5 == 0) {
			System.out.println("5");
		} input3 == 0 input3 0 {
			System.out.println("3");
		} System.out.println("3") System.out.println System.out System System.out "3" if(input4 == 0) {
			System.out.println("4");
		}else if(input5 == 0) {
			System.out.println("5");
		} input4 == 0 input4 0 {
			System.out.println("4");
		} System.out.println("4") System.out.println System.out System System.out "4" if(input5 == 0) {
			System.out.println("5");
		} input5 == 0 input5 0 {
			System.out.println("5");
		} System.out.println("5") System.out.println System.out System System.out "5" scanner.close() scanner.close scanner String[] args args public class Main {

	public static void main(String[] args) throws Exception{
		Scanner scanner = new Scanner(System.in);
		int input1 = Integer.parseInt(scanner.next());
		int input2 = Integer.parseInt(scanner.next());
		int input3 = Integer.parseInt(scanner.next());
		int input4 = Integer.parseInt(scanner.next());
		int input5 = Integer.parseInt(scanner.next());
		
		if(input1 ==0) {
			System.out.println("1");
		}else if(input2 == 0) {
			System.out.println("2");
		}else if(input3 == 0) {
			System.out.println("3");
		}else if(input4 == 0) {
			System.out.println("4");
		}else if(input5 == 0) {
			System.out.println("5");
		}
		scanner.close();
	}
} public class Main {

	public static void main(String[] args) throws Exception{
		Scanner scanner = new Scanner(System.in);
		int input1 = Integer.parseInt(scanner.next());
		int input2 = Integer.parseInt(scanner.next());
		int input3 = Integer.parseInt(scanner.next());
		int input4 = Integer.parseInt(scanner.next());
		int input5 = Integer.parseInt(scanner.next());
		
		if(input1 ==0) {
			System.out.println("1");
		}else if(input2 == 0) {
			System.out.println("2");
		}else if(input3 == 0) {
			System.out.println("3");
		}else if(input4 == 0) {
			System.out.println("4");
		}else if(input5 == 0) {
			System.out.println("5");
		}
		scanner.close();
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception{
		Scanner scanner = new Scanner(System.in);
		int input1 = Integer.parseInt(scanner.next());
		int input2 = Integer.parseInt(scanner.next());
		int input3 = Integer.parseInt(scanner.next());
		int input4 = Integer.parseInt(scanner.next());
		int input5 = Integer.parseInt(scanner.next());
		
		if(input1 ==0) {
			System.out.println("1");
		}else if(input2 == 0) {
			System.out.println("2");
		}else if(input3 == 0) {
			System.out.println("3");
		}else if(input4 == 0) {
			System.out.println("4");
		}else if(input5 == 0) {
			System.out.println("5");
		}
		scanner.close();
	}
}
