import java.util.*;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            // in
            for (int i = 0; i < 5; i++) {
                int in = Integer.parseInt(sc.next());
                if (in == 0) {
                    System.out.println(i + 1);
                    break;
                }
            }
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            // in
            for (int i = 0; i < 5; i++) {
                int in = Integer.parseInt(sc.next());
                if (in == 0) {
                    System.out.println(i + 1);
                    break;
                }
            }
        }
    }
} Main public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            // in
            for (int i = 0; i < 5; i++) {
                int in = Integer.parseInt(sc.next());
                if (in == 0) {
                    System.out.println(i + 1);
                    break;
                }
            }
        }
    } main {
        try (Scanner sc = new Scanner(System.in)) {
            // in
            for (int i = 0; i < 5; i++) {
                int in = Integer.parseInt(sc.next());
                if (in == 0) {
                    System.out.println(i + 1);
                    break;
                }
            }
        }
    } try (Scanner sc = new Scanner(System.in)) {
            // in
            for (int i = 0; i < 5; i++) {
                int in = Integer.parseInt(sc.next());
                if (in == 0) {
                    System.out.println(i + 1);
                    break;
                }
            }
        } {
            // in
            for (int i = 0; i < 5; i++) {
                int in = Integer.parseInt(sc.next());
                if (in == 0) {
                    System.out.println(i + 1);
                    break;
                }
            }
        } Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) for (int i = 0; i < 5; i++) {
                int in = Integer.parseInt(sc.next());
                if (in == 0) {
                    System.out.println(i + 1);
                    break;
                }
            } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
                int in = Integer.parseInt(sc.next());
                if (in == 0) {
                    System.out.println(i + 1);
                    break;
                }
            } {
                int in = Integer.parseInt(sc.next());
                if (in == 0) {
                    System.out.println(i + 1);
                    break;
                }
            } int in = Integer.parseInt(sc.next()); in Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc if (in == 0) {
                    System.out.println(i + 1);
                    break;
                } in == 0 in 0 {
                    System.out.println(i + 1);
                    break;
                } System.out.println(i + 1) System.out.println System.out System System.out i + 1 i 1 break; String[] args args public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            // in
            for (int i = 0; i < 5; i++) {
                int in = Integer.parseInt(sc.next());
                if (in == 0) {
                    System.out.println(i + 1);
                    break;
                }
            }
        }
    }
} public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            // in
            for (int i = 0; i < 5; i++) {
                int in = Integer.parseInt(sc.next());
                if (in == 0) {
                    System.out.println(i + 1);
                    break;
                }
            }
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            // in
            for (int i = 0; i < 5; i++) {
                int in = Integer.parseInt(sc.next());
                if (in == 0) {
                    System.out.println(i + 1);
                    break;
                }
            }
        }
    }
}
