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

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        //int n = sc.nextInt();
        int flag = 0;
        for(int i=1;i<=5;i++){
            int x = sc.nextInt();
            if(x == 0)flag=i;
        }
        System.out.println(flag);
    }
} import java.util.*; util.* java import java.io.*; io.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        //int n = sc.nextInt();
        int flag = 0;
        for(int i=1;i<=5;i++){
            int x = sc.nextInt();
            if(x == 0)flag=i;
        }
        System.out.println(flag);
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        //int n = sc.nextInt();
        int flag = 0;
        for(int i=1;i<=5;i++){
            int x = sc.nextInt();
            if(x == 0)flag=i;
        }
        System.out.println(flag);
    } main {
        Scanner sc = new Scanner(System.in);
        //int n = sc.nextInt();
        int flag = 0;
        for(int i=1;i<=5;i++){
            int x = sc.nextInt();
            if(x == 0)flag=i;
        }
        System.out.println(flag);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int flag = 0; flag 0 for(int i=1;i<=5;i++){
            int x = sc.nextInt();
            if(x == 0)flag=i;
        } int i=1; int i=1; i 1 i<=5 i 5 i++ i++ i {
            int x = sc.nextInt();
            if(x == 0)flag=i;
        } {
            int x = sc.nextInt();
            if(x == 0)flag=i;
        } int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc if(x == 0)flag=i; x == 0 x 0 flag=i flag i System.out.println(flag) System.out.println System.out System System.out flag String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        //int n = sc.nextInt();
        int flag = 0;
        for(int i=1;i<=5;i++){
            int x = sc.nextInt();
            if(x == 0)flag=i;
        }
        System.out.println(flag);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        //int n = sc.nextInt();
        int flag = 0;
        for(int i=1;i<=5;i++){
            int x = sc.nextInt();
            if(x == 0)flag=i;
        }
        System.out.println(flag);
    }
} Main
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        //int n = sc.nextInt();
        int flag = 0;
        for(int i=1;i<=5;i++){
            int x = sc.nextInt();
            if(x == 0)flag=i;
        }
        System.out.println(flag);
    }
}
