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

public class Main{
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String[] cmd=br.readLine().split(" ");
		for(int i=0;i<5;i++)
		{
			if(Integer.valueOf(cmd[i])==0)
			{
				System.out.println(i+1);
				break;
			}
		}
	}

} import java.util.*; util.* java import java.io.*; io.* java public class Main{
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String[] cmd=br.readLine().split(" ");
		for(int i=0;i<5;i++)
		{
			if(Integer.valueOf(cmd[i])==0)
			{
				System.out.println(i+1);
				break;
			}
		}
	}

} Main public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String[] cmd=br.readLine().split(" ");
		for(int i=0;i<5;i++)
		{
			if(Integer.valueOf(cmd[i])==0)
			{
				System.out.println(i+1);
				break;
			}
		}
	} main {
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String[] cmd=br.readLine().split(" ");
		for(int i=0;i<5;i++)
		{
			if(Integer.valueOf(cmd[i])==0)
			{
				System.out.println(i+1);
				break;
			}
		}
	} BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] cmd=br.readLine().split(" "); cmd br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i=0;i<5;i++)
		{
			if(Integer.valueOf(cmd[i])==0)
			{
				System.out.println(i+1);
				break;
			}
		} int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
			if(Integer.valueOf(cmd[i])==0)
			{
				System.out.println(i+1);
				break;
			}
		} {
			if(Integer.valueOf(cmd[i])==0)
			{
				System.out.println(i+1);
				break;
			}
		} if(Integer.valueOf(cmd[i])==0)
			{
				System.out.println(i+1);
				break;
			} Integer.valueOf(cmd[i])==0 Integer.valueOf(cmd[i]) Integer.valueOf Integer cmd[i] cmd i 0 {
				System.out.println(i+1);
				break;
			} System.out.println(i+1) System.out.println System.out System System.out i+1 i 1 break; String[] args args public class Main{
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String[] cmd=br.readLine().split(" ");
		for(int i=0;i<5;i++)
		{
			if(Integer.valueOf(cmd[i])==0)
			{
				System.out.println(i+1);
				break;
			}
		}
	}

} public class Main{
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String[] cmd=br.readLine().split(" ");
		for(int i=0;i<5;i++)
		{
			if(Integer.valueOf(cmd[i])==0)
			{
				System.out.println(i+1);
				break;
			}
		}
	}

} Main

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

public class Main{
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String[] cmd=br.readLine().split(" ");
		for(int i=0;i<5;i++)
		{
			if(Integer.valueOf(cmd[i])==0)
			{
				System.out.println(i+1);
				break;
			}
		}
	}

}
