import java.io.*;
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
import java.math.BigDecimal;

public class Main{

    public static void main(String[] args){
        //START

        Scanner sc=new Scanner(System.in);

        int A=sc.nextInt();
        int B=sc.nextInt();
        int C=sc.nextInt();
        int D=sc.nextInt();
        int E=sc.nextInt();

        if(A==0){
            System.out.println("1");
        }else if(B==0){
            System.out.println("2");
        }else if(C==0){
            System.out.println("3");
        }else if(D==0){
            System.out.println("4");
        }else{
            System.out.println("5");
        }




        //END
    }
}

 import java.io.*; io.* java import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util import java.util.ArrayList; ArrayList java.util import java.math.BigDecimal; BigDecimal java.math public class Main{

    public static void main(String[] args){
        //START

        Scanner sc=new Scanner(System.in);

        int A=sc.nextInt();
        int B=sc.nextInt();
        int C=sc.nextInt();
        int D=sc.nextInt();
        int E=sc.nextInt();

        if(A==0){
            System.out.println("1");
        }else if(B==0){
            System.out.println("2");
        }else if(C==0){
            System.out.println("3");
        }else if(D==0){
            System.out.println("4");
        }else{
            System.out.println("5");
        }




        //END
    }
} Main public static void main(String[] args){
        //START

        Scanner sc=new Scanner(System.in);

        int A=sc.nextInt();
        int B=sc.nextInt();
        int C=sc.nextInt();
        int D=sc.nextInt();
        int E=sc.nextInt();

        if(A==0){
            System.out.println("1");
        }else if(B==0){
            System.out.println("2");
        }else if(C==0){
            System.out.println("3");
        }else if(D==0){
            System.out.println("4");
        }else{
            System.out.println("5");
        }




        //END
    } main {
        //START

        Scanner sc=new Scanner(System.in);

        int A=sc.nextInt();
        int B=sc.nextInt();
        int C=sc.nextInt();
        int D=sc.nextInt();
        int E=sc.nextInt();

        if(A==0){
            System.out.println("1");
        }else if(B==0){
            System.out.println("2");
        }else if(C==0){
            System.out.println("3");
        }else if(D==0){
            System.out.println("4");
        }else{
            System.out.println("5");
        }




        //END
    } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int A=sc.nextInt(); A sc.nextInt() sc.nextInt sc int B=sc.nextInt(); B sc.nextInt() sc.nextInt sc int C=sc.nextInt(); C sc.nextInt() sc.nextInt sc int D=sc.nextInt(); D sc.nextInt() sc.nextInt sc int E=sc.nextInt(); E sc.nextInt() sc.nextInt sc if(A==0){
            System.out.println("1");
        }else if(B==0){
            System.out.println("2");
        }else if(C==0){
            System.out.println("3");
        }else if(D==0){
            System.out.println("4");
        }else{
            System.out.println("5");
        } A==0 A 0 {
            System.out.println("1");
        } System.out.println("1") System.out.println System.out System System.out "1" if(B==0){
            System.out.println("2");
        }else if(C==0){
            System.out.println("3");
        }else if(D==0){
            System.out.println("4");
        }else{
            System.out.println("5");
        } B==0 B 0 {
            System.out.println("2");
        } System.out.println("2") System.out.println System.out System System.out "2" if(C==0){
            System.out.println("3");
        }else if(D==0){
            System.out.println("4");
        }else{
            System.out.println("5");
        } C==0 C 0 {
            System.out.println("3");
        } System.out.println("3") System.out.println System.out System System.out "3" if(D==0){
            System.out.println("4");
        }else{
            System.out.println("5");
        } D==0 D 0 {
            System.out.println("4");
        } System.out.println("4") System.out.println System.out System System.out "4" {
            System.out.println("5");
        } System.out.println("5") System.out.println System.out System System.out "5" String[] args args public class Main{

    public static void main(String[] args){
        //START

        Scanner sc=new Scanner(System.in);

        int A=sc.nextInt();
        int B=sc.nextInt();
        int C=sc.nextInt();
        int D=sc.nextInt();
        int E=sc.nextInt();

        if(A==0){
            System.out.println("1");
        }else if(B==0){
            System.out.println("2");
        }else if(C==0){
            System.out.println("3");
        }else if(D==0){
            System.out.println("4");
        }else{
            System.out.println("5");
        }




        //END
    }
} public class Main{

    public static void main(String[] args){
        //START

        Scanner sc=new Scanner(System.in);

        int A=sc.nextInt();
        int B=sc.nextInt();
        int C=sc.nextInt();
        int D=sc.nextInt();
        int E=sc.nextInt();

        if(A==0){
            System.out.println("1");
        }else if(B==0){
            System.out.println("2");
        }else if(C==0){
            System.out.println("3");
        }else if(D==0){
            System.out.println("4");
        }else{
            System.out.println("5");
        }




        //END
    }
} Main
import java.io.*;
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
import java.math.BigDecimal;

public class Main{

    public static void main(String[] args){
        //START

        Scanner sc=new Scanner(System.in);

        int A=sc.nextInt();
        int B=sc.nextInt();
        int C=sc.nextInt();
        int D=sc.nextInt();
        int E=sc.nextInt();

        if(A==0){
            System.out.println("1");
        }else if(B==0){
            System.out.println("2");
        }else if(C==0){
            System.out.println("3");
        }else if(D==0){
            System.out.println("4");
        }else{
            System.out.println("5");
        }




        //END
    }
}


