import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(System.out);
        String str[]=br.readLine().split(" ");
        for(int i=0;i<5;i++)
        {
            if(Integer.parseInt(str[i])==0)
            {
                pw.println(i+1);
                break;
            }
        }
        pw.flush();
        pw.close();
    }
} import java.util.*; util.* java import java.io.*; io.* java public class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(System.out);
        String str[]=br.readLine().split(" ");
        for(int i=0;i<5;i++)
        {
            if(Integer.parseInt(str[i])==0)
            {
                pw.println(i+1);
                break;
            }
        }
        pw.flush();
        pw.close();
    }
} Main public static void main(String args[])throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(System.out);
        String str[]=br.readLine().split(" ");
        for(int i=0;i<5;i++)
        {
            if(Integer.parseInt(str[i])==0)
            {
                pw.println(i+1);
                break;
            }
        }
        pw.flush();
        pw.close();
    } main {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(System.out);
        String str[]=br.readLine().split(" ");
        for(int i=0;i<5;i++)
        {
            if(Integer.parseInt(str[i])==0)
            {
                pw.println(i+1);
                break;
            }
        }
        pw.flush();
        pw.close();
    } BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) PrintWriter pw=new PrintWriter(System.out); pw new PrintWriter(System.out) String str[]=br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i=0;i<5;i++)
        {
            if(Integer.parseInt(str[i])==0)
            {
                pw.println(i+1);
                break;
            }
        } int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
            if(Integer.parseInt(str[i])==0)
            {
                pw.println(i+1);
                break;
            }
        } {
            if(Integer.parseInt(str[i])==0)
            {
                pw.println(i+1);
                break;
            }
        } if(Integer.parseInt(str[i])==0)
            {
                pw.println(i+1);
                break;
            } Integer.parseInt(str[i])==0 Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i 0 {
                pw.println(i+1);
                break;
            } pw.println(i+1) pw.println pw i+1 i 1 break; pw.flush() pw.flush pw pw.close() pw.close pw String args[] args public class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(System.out);
        String str[]=br.readLine().split(" ");
        for(int i=0;i<5;i++)
        {
            if(Integer.parseInt(str[i])==0)
            {
                pw.println(i+1);
                break;
            }
        }
        pw.flush();
        pw.close();
    }
} public class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(System.out);
        String str[]=br.readLine().split(" ");
        for(int i=0;i<5;i++)
        {
            if(Integer.parseInt(str[i])==0)
            {
                pw.println(i+1);
                break;
            }
        }
        pw.flush();
        pw.close();
    }
} Main
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(System.out);
        String str[]=br.readLine().split(" ");
        for(int i=0;i<5;i++)
        {
            if(Integer.parseInt(str[i])==0)
            {
                pw.println(i+1);
                break;
            }
        }
        pw.flush();
        pw.close();
    }
}