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

import static java.lang.Character.isUpperCase;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();
        int d = in.nextInt();
        int e = in.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);

           }
    }




    }

 import java.util.*; util.* java import java.io.*; io.* java import static java.lang.Character.isUpperCase; import static java.lang.Character.isUpperCase; import static java.lang.Character.isUpperCase; public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();
        int d = in.nextInt();
        int e = in.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);

           }
    }




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

        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();
        int d = in.nextInt();
        int e = in.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);

           }
    } main {

        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();
        int d = in.nextInt();
        int e = in.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);

           }
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int a = in.nextInt(); a in.nextInt() in.nextInt in int b = in.nextInt(); b in.nextInt() in.nextInt in int c = in.nextInt(); c in.nextInt() in.nextInt in int d = in.nextInt(); d in.nextInt() in.nextInt in int e = in.nextInt(); e in.nextInt() in.nextInt in 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) {

        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();
        int d = in.nextInt();
        int e = in.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);

           }
    }




    } public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();
        int d = in.nextInt();
        int e = in.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);

           }
    }




    } Main

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

import static java.lang.Character.isUpperCase;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();
        int d = in.nextInt();
        int e = in.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);

           }
    }




    }


