import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC170_a solver = new ABC170_a();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC170_a {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            for (int i = 0; i < 5; i++) {
                int into = in.nextInt();
                if (into == 0) {
                    out.println(i + 1);
                    return;
                }

            }

        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC170_a solver = new ABC170_a();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC170_a {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            for (int i = 0; i < 5; i++) {
                int into = in.nextInt();
                if (into == 0) {
                    out.println(i + 1);
                    return;
                }

            }

        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC170_a solver = new ABC170_a();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC170_a solver = new ABC170_a();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) ABC170_a solver = new ABC170_a(); solver new ABC170_a() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class ABC170_a {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            for (int i = 0; i < 5; i++) {
                int into = in.nextInt();
                if (into == 0) {
                    out.println(i + 1);
                    return;
                }

            }

        }

    } ABC170_a public void solve(int testNumber, Scanner in, PrintWriter out) {
            for (int i = 0; i < 5; i++) {
                int into = in.nextInt();
                if (into == 0) {
                    out.println(i + 1);
                    return;
                }

            }

        } solve {
            for (int i = 0; i < 5; i++) {
                int into = in.nextInt();
                if (into == 0) {
                    out.println(i + 1);
                    return;
                }

            }

        } for (int i = 0; i < 5; i++) {
                int into = in.nextInt();
                if (into == 0) {
                    out.println(i + 1);
                    return;
                }

            } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
                int into = in.nextInt();
                if (into == 0) {
                    out.println(i + 1);
                    return;
                }

            } {
                int into = in.nextInt();
                if (into == 0) {
                    out.println(i + 1);
                    return;
                }

            } int into = in.nextInt(); into in.nextInt() in.nextInt in if (into == 0) {
                    out.println(i + 1);
                    return;
                } into == 0 into 0 {
                    out.println(i + 1);
                    return;
                } out.println(i + 1) out.println out i + 1 i 1 return; int testNumber testNumber Scanner in in PrintWriter out out public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC170_a solver = new ABC170_a();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC170_a {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            for (int i = 0; i < 5; i++) {
                int into = in.nextInt();
                if (into == 0) {
                    out.println(i + 1);
                    return;
                }

            }

        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC170_a solver = new ABC170_a();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC170_a {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            for (int i = 0; i < 5; i++) {
                int into = in.nextInt();
                if (into == 0) {
                    out.println(i + 1);
                    return;
                }

            }

        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC170_a solver = new ABC170_a();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC170_a {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            for (int i = 0; i < 5; i++) {
                int into = in.nextInt();
                if (into == 0) {
                    out.println(i + 1);
                    return;
                }

            }

        }

    }
}

