import java.io.*;
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;

public class Main
{	
	public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		String []s=br.readLine().split(" ");
		
		int ans=0;
		
		for(int i=0;i<5;i++)
		{
			int a=Integer.parseInt(s[i]);
				if(a==0)
					ans=i+1;
		}
			
		out.println(ans);
		
	}
	
	
}

 import java.io.*; io.* java import java.util.*; util.* java import static java.lang.System.*; import static java.lang.System.*; import static java.lang.System.*; import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; public class Main
{	
	public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		String []s=br.readLine().split(" ");
		
		int ans=0;
		
		for(int i=0;i<5;i++)
		{
			int a=Integer.parseInt(s[i]);
				if(a==0)
					ans=i+1;
		}
			
		out.println(ans);
		
	}
	
	
} Main public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		String []s=br.readLine().split(" ");
		
		int ans=0;
		
		for(int i=0;i<5;i++)
		{
			int a=Integer.parseInt(s[i]);
				if(a==0)
					ans=i+1;
		}
			
		out.println(ans);
		
	} main {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		String []s=br.readLine().split(" ");
		
		int ans=0;
		
		for(int i=0;i<5;i++)
		{
			int a=Integer.parseInt(s[i]);
				if(a==0)
					ans=i+1;
		}
			
		out.println(ans);
		
	} BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String []s=br.readLine().split(" "); s br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int ans=0; ans 0 for(int i=0;i<5;i++)
		{
			int a=Integer.parseInt(s[i]);
				if(a==0)
					ans=i+1;
		} int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
			int a=Integer.parseInt(s[i]);
				if(a==0)
					ans=i+1;
		} {
			int a=Integer.parseInt(s[i]);
				if(a==0)
					ans=i+1;
		} int a=Integer.parseInt(s[i]); a Integer.parseInt(s[i]) Integer.parseInt Integer s[i] s i if(a==0)
					ans=i+1; a==0 a 0 ans=i+1 ans i+1 i 1 out.println(ans) out.println out ans String []args args public class Main
{	
	public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		String []s=br.readLine().split(" ");
		
		int ans=0;
		
		for(int i=0;i<5;i++)
		{
			int a=Integer.parseInt(s[i]);
				if(a==0)
					ans=i+1;
		}
			
		out.println(ans);
		
	}
	
	
} public class Main
{	
	public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		String []s=br.readLine().split(" ");
		
		int ans=0;
		
		for(int i=0;i<5;i++)
		{
			int a=Integer.parseInt(s[i]);
				if(a==0)
					ans=i+1;
		}
			
		out.println(ans);
		
	}
	
	
} Main
import java.io.*;
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;

public class Main
{	
	public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		String []s=br.readLine().split(" ");
		
		int ans=0;
		
		for(int i=0;i<5;i++)
		{
			int a=Integer.parseInt(s[i]);
				if(a==0)
					ans=i+1;
		}
			
		out.println(ans);
		
	}
	
	
}


