import java.util.*;

public class Main {
    public static void main(String[] args) {
      Scanner s = new Scanner(System.in);
        List<String> xList = new ArrayList<String>();
        for (int i = 0 ; i < 5 ;i++) {
            xList.add(s.next());
        }
        System.out.println(xList.indexOf("0") + 1);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
      Scanner s = new Scanner(System.in);
        List<String> xList = new ArrayList<String>();
        for (int i = 0 ; i < 5 ;i++) {
            xList.add(s.next());
        }
        System.out.println(xList.indexOf("0") + 1);
    }
} Main public static void main(String[] args) {
      Scanner s = new Scanner(System.in);
        List<String> xList = new ArrayList<String>();
        for (int i = 0 ; i < 5 ;i++) {
            xList.add(s.next());
        }
        System.out.println(xList.indexOf("0") + 1);
    } main {
      Scanner s = new Scanner(System.in);
        List<String> xList = new ArrayList<String>();
        for (int i = 0 ; i < 5 ;i++) {
            xList.add(s.next());
        }
        System.out.println(xList.indexOf("0") + 1);
    } Scanner s = new Scanner(System.in); s new Scanner(System.in) List<String> xList = new ArrayList<String>(); xList new ArrayList<String>() for (int i = 0 ; i < 5 ;i++) {
            xList.add(s.next());
        } int i = 0 ; int i = 0 ; i 0 i < 5 i 5 i++ i++ i {
            xList.add(s.next());
        } {
            xList.add(s.next());
        } xList.add(s.next()) xList.add xList s.next() s.next s System.out.println(xList.indexOf("0") + 1) System.out.println System.out System System.out xList.indexOf("0") + 1 xList.indexOf("0") xList.indexOf xList "0" 1 String[] args args public class Main {
    public static void main(String[] args) {
      Scanner s = new Scanner(System.in);
        List<String> xList = new ArrayList<String>();
        for (int i = 0 ; i < 5 ;i++) {
            xList.add(s.next());
        }
        System.out.println(xList.indexOf("0") + 1);
    }
} public class Main {
    public static void main(String[] args) {
      Scanner s = new Scanner(System.in);
        List<String> xList = new ArrayList<String>();
        for (int i = 0 ; i < 5 ;i++) {
            xList.add(s.next());
        }
        System.out.println(xList.indexOf("0") + 1);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
      Scanner s = new Scanner(System.in);
        List<String> xList = new ArrayList<String>();
        for (int i = 0 ; i < 5 ;i++) {
            xList.add(s.next());
        }
        System.out.println(xList.indexOf("0") + 1);
    }
}