/* package codechef; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
    public static void main (String[] args) throws java.lang.Exception
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int i=1;
        for (; i<6; i++){
            if (Integer.parseInt(st.nextToken())==0)
                break;
        }
        System.out.println(i);
    }




}
 import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java class Main
{
    public static void main (String[] args) throws java.lang.Exception
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int i=1;
        for (; i<6; i++){
            if (Integer.parseInt(st.nextToken())==0)
                break;
        }
        System.out.println(i);
    }




} Main public static void main (String[] args) throws java.lang.Exception
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int i=1;
        for (; i<6; i++){
            if (Integer.parseInt(st.nextToken())==0)
                break;
        }
        System.out.println(i);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int i=1;
        for (; i<6; i++){
            if (Integer.parseInt(st.nextToken())==0)
                break;
        }
        System.out.println(i);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringTokenizer st = new StringTokenizer(br.readLine()); st new StringTokenizer(br.readLine()) int i=1; i 1 for (; i<6; i++){
            if (Integer.parseInt(st.nextToken())==0)
                break;
        } ; i<6 i 6 i++ i++ i {
            if (Integer.parseInt(st.nextToken())==0)
                break;
        } {
            if (Integer.parseInt(st.nextToken())==0)
                break;
        } if (Integer.parseInt(st.nextToken())==0)
                break; Integer.parseInt(st.nextToken())==0 Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st 0 break; System.out.println(i) System.out.println System.out System System.out i String[] args args
/* package codechef; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
    public static void main (String[] args) throws java.lang.Exception
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int i=1;
        for (; i<6; i++){
            if (Integer.parseInt(st.nextToken())==0)
                break;
        }
        System.out.println(i);
    }




}

