import java.io.*;
import java.util.StringTokenizer;

public class Main{
	public static void main(String [] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
	
		StringTokenizer st = new StringTokenizer(br.readLine());

		for(int i=1;i<6;i++){
			int cur = Integer.parseInt(st.nextToken());
			if(cur == 0){
				bw.write(i+"");
				break;
			}
		}

		bw.flush();
		bw.close();
		br.close();
	}
} import java.io.*; io.* java import java.util.StringTokenizer; StringTokenizer java.util public class Main{
	public static void main(String [] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
	
		StringTokenizer st = new StringTokenizer(br.readLine());

		for(int i=1;i<6;i++){
			int cur = Integer.parseInt(st.nextToken());
			if(cur == 0){
				bw.write(i+"");
				break;
			}
		}

		bw.flush();
		bw.close();
		br.close();
	}
} Main public static void main(String [] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
	
		StringTokenizer st = new StringTokenizer(br.readLine());

		for(int i=1;i<6;i++){
			int cur = Integer.parseInt(st.nextToken());
			if(cur == 0){
				bw.write(i+"");
				break;
			}
		}

		bw.flush();
		bw.close();
		br.close();
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
	
		StringTokenizer st = new StringTokenizer(br.readLine());

		for(int i=1;i<6;i++){
			int cur = Integer.parseInt(st.nextToken());
			if(cur == 0){
				bw.write(i+"");
				break;
			}
		}

		bw.flush();
		bw.close();
		br.close();
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); bw new BufferedWriter(new OutputStreamWriter(System.out)) StringTokenizer st = new StringTokenizer(br.readLine()); st new StringTokenizer(br.readLine()) for(int i=1;i<6;i++){
			int cur = Integer.parseInt(st.nextToken());
			if(cur == 0){
				bw.write(i+"");
				break;
			}
		} int i=1; int i=1; i 1 i<6 i 6 i++ i++ i {
			int cur = Integer.parseInt(st.nextToken());
			if(cur == 0){
				bw.write(i+"");
				break;
			}
		} {
			int cur = Integer.parseInt(st.nextToken());
			if(cur == 0){
				bw.write(i+"");
				break;
			}
		} int cur = Integer.parseInt(st.nextToken()); cur Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st if(cur == 0){
				bw.write(i+"");
				break;
			} cur == 0 cur 0 {
				bw.write(i+"");
				break;
			} bw.write(i+"") bw.write bw i+"" i "" break; bw.flush() bw.flush bw bw.close() bw.close bw br.close() br.close br String [] args args public class Main{
	public static void main(String [] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
	
		StringTokenizer st = new StringTokenizer(br.readLine());

		for(int i=1;i<6;i++){
			int cur = Integer.parseInt(st.nextToken());
			if(cur == 0){
				bw.write(i+"");
				break;
			}
		}

		bw.flush();
		bw.close();
		br.close();
	}
} public class Main{
	public static void main(String [] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
	
		StringTokenizer st = new StringTokenizer(br.readLine());

		for(int i=1;i<6;i++){
			int cur = Integer.parseInt(st.nextToken());
			if(cur == 0){
				bw.write(i+"");
				break;
			}
		}

		bw.flush();
		bw.close();
		br.close();
	}
} Main
import java.io.*;
import java.util.StringTokenizer;

public class Main{
	public static void main(String [] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
	
		StringTokenizer st = new StringTokenizer(br.readLine());

		for(int i=1;i<6;i++){
			int cur = Integer.parseInt(st.nextToken());
			if(cur == 0){
				bw.write(i+"");
				break;
			}
		}

		bw.flush();
		bw.close();
		br.close();
	}
}