import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int X = 0;
		int []p = new int[5];
		for(int a = 0; a < 5; a++){
			p[a] = stdIn.nextInt();
			if(p[a] == 0){
				X = a;
			}
		}
		System.out.println(X+1);
		stdIn.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int X = 0;
		int []p = new int[5];
		for(int a = 0; a < 5; a++){
			p[a] = stdIn.nextInt();
			if(p[a] == 0){
				X = a;
			}
		}
		System.out.println(X+1);
		stdIn.close();
	}
} Main public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int X = 0;
		int []p = new int[5];
		for(int a = 0; a < 5; a++){
			p[a] = stdIn.nextInt();
			if(p[a] == 0){
				X = a;
			}
		}
		System.out.println(X+1);
		stdIn.close();
	} main {
		Scanner stdIn = new Scanner(System.in);
		int X = 0;
		int []p = new int[5];
		for(int a = 0; a < 5; a++){
			p[a] = stdIn.nextInt();
			if(p[a] == 0){
				X = a;
			}
		}
		System.out.println(X+1);
		stdIn.close();
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int X = 0; X 0 int []p = new int[5]; p new int[5] 5 for(int a = 0; a < 5; a++){
			p[a] = stdIn.nextInt();
			if(p[a] == 0){
				X = a;
			}
		} int a = 0; int a = 0; a 0 a < 5 a 5 a++ a++ a {
			p[a] = stdIn.nextInt();
			if(p[a] == 0){
				X = a;
			}
		} {
			p[a] = stdIn.nextInt();
			if(p[a] == 0){
				X = a;
			}
		} p[a] = stdIn.nextInt() p[a] p a stdIn.nextInt() stdIn.nextInt stdIn if(p[a] == 0){
				X = a;
			} p[a] == 0 p[a] p a 0 {
				X = a;
			} X = a X a System.out.println(X+1) System.out.println System.out System System.out X+1 X 1 stdIn.close() stdIn.close stdIn String[] args args public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int X = 0;
		int []p = new int[5];
		for(int a = 0; a < 5; a++){
			p[a] = stdIn.nextInt();
			if(p[a] == 0){
				X = a;
			}
		}
		System.out.println(X+1);
		stdIn.close();
	}
} public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int X = 0;
		int []p = new int[5];
		for(int a = 0; a < 5; a++){
			p[a] = stdIn.nextInt();
			if(p[a] == 0){
				X = a;
			}
		}
		System.out.println(X+1);
		stdIn.close();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int X = 0;
		int []p = new int[5];
		for(int a = 0; a < 5; a++){
			p[a] = stdIn.nextInt();
			if(p[a] == 0){
				X = a;
			}
		}
		System.out.println(X+1);
		stdIn.close();
	}
}
