import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.System.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    static void solve() throws Exception {
        for (int i = 1; i <= 5; i++) {
            if (scanInt() == 0) {
                System.out.println(i);
                break;
            }
        }
    }

    static int scanInt() throws IOException {
        return parseInt(scanString());
    }

    static long scanLong() throws IOException {
        return parseLong(scanString());
    }

    static String scanString() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        }
        catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    }
} import static java.lang.Integer.*; import static java.lang.Integer.*; import static java.lang.Integer.*; import static java.lang.Long.*; import static java.lang.Long.*; import static java.lang.Long.*; import static java.lang.System.*; import static java.lang.System.*; import static java.lang.System.*; import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main {

    static void solve() throws Exception {
        for (int i = 1; i <= 5; i++) {
            if (scanInt() == 0) {
                System.out.println(i);
                break;
            }
        }
    }

    static int scanInt() throws IOException {
        return parseInt(scanString());
    }

    static long scanLong() throws IOException {
        return parseLong(scanString());
    }

    static String scanString() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        }
        catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    }
} Main static BufferedReader in; in static PrintWriter out; out static StringTokenizer tok; tok static void solve() throws Exception {
        for (int i = 1; i <= 5; i++) {
            if (scanInt() == 0) {
                System.out.println(i);
                break;
            }
        }
    } solve {
        for (int i = 1; i <= 5; i++) {
            if (scanInt() == 0) {
                System.out.println(i);
                break;
            }
        }
    } for (int i = 1; i <= 5; i++) {
            if (scanInt() == 0) {
                System.out.println(i);
                break;
            }
        } int i = 1; int i = 1; i 1 i <= 5 i 5 i++ i++ i {
            if (scanInt() == 0) {
                System.out.println(i);
                break;
            }
        } {
            if (scanInt() == 0) {
                System.out.println(i);
                break;
            }
        } if (scanInt() == 0) {
                System.out.println(i);
                break;
            } scanInt() == 0 scanInt() scanInt 0 {
                System.out.println(i);
                break;
            } System.out.println(i) System.out.println System.out System System.out i break; static int scanInt() throws IOException {
        return parseInt(scanString());
    } scanInt {
        return parseInt(scanString());
    } return parseInt(scanString()); parseInt(scanString()) parseInt scanString() scanString static long scanLong() throws IOException {
        return parseLong(scanString());
    } scanLong {
        return parseLong(scanString());
    } return parseLong(scanString()); parseLong(scanString()) parseLong scanString() scanString static String scanString() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    } scanString {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    } while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        } tok == null || !tok.hasMoreTokens() tok == null tok null !tok.hasMoreTokens() tok.hasMoreTokens() tok.hasMoreTokens tok {
            tok = new StringTokenizer(in.readLine());
        } tok = new StringTokenizer(in.readLine()) tok new StringTokenizer(in.readLine()) return tok.nextToken(); tok.nextToken() tok.nextToken tok public static void main(String[] args) {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        }
        catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    } main {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        }
        catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    } try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        }
        catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        } catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        } Throwable e {
            e.printStackTrace();
            exit(1);
        } e.printStackTrace() e.printStackTrace e exit(1) exit 1 {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        } in = new BufferedReader(new InputStreamReader(System.in)) in new BufferedReader(new InputStreamReader(System.in)) out = new PrintWriter(System.out) out new PrintWriter(System.out) solve() solve in.close() in.close in out.close() out.close out String[] args args public class Main {

    static void solve() throws Exception {
        for (int i = 1; i <= 5; i++) {
            if (scanInt() == 0) {
                System.out.println(i);
                break;
            }
        }
    }

    static int scanInt() throws IOException {
        return parseInt(scanString());
    }

    static long scanLong() throws IOException {
        return parseLong(scanString());
    }

    static String scanString() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        }
        catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    }
} public class Main {

    static void solve() throws Exception {
        for (int i = 1; i <= 5; i++) {
            if (scanInt() == 0) {
                System.out.println(i);
                break;
            }
        }
    }

    static int scanInt() throws IOException {
        return parseInt(scanString());
    }

    static long scanLong() throws IOException {
        return parseLong(scanString());
    }

    static String scanString() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        }
        catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    }
} Main
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.System.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    static void solve() throws Exception {
        for (int i = 1; i <= 5; i++) {
            if (scanInt() == 0) {
                System.out.println(i);
                break;
            }
        }
    }

    static int scanInt() throws IOException {
        return parseInt(scanString());
    }

    static long scanLong() throws IOException {
        return parseLong(scanString());
    }

    static String scanString() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        }
        catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    }
}