import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        for(int i = 0; i < 5; i++) {
            int x = scan.nextInt();
            if(x == 0){
                os.println(i+1);
                return;
            }
        }
    }
} import java.io.InputStream; InputStream java.io import java.io.PrintStream; PrintStream java.io import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        for(int i = 0; i < 5; i++) {
            int x = scan.nextInt();
            if(x == 0){
                os.println(i+1);
                return;
            }
        }
    }
} Main public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    } main {
        solve(System.in, System.out);
    } solve(System.in, System.out) solve System.in System System.in System.out System System.out String[] args args static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        for(int i = 0; i < 5; i++) {
            int x = scan.nextInt();
            if(x == 0){
                os.println(i+1);
                return;
            }
        }
    } solve {
        // Your code here!
        Scanner scan = new Scanner(is);
        for(int i = 0; i < 5; i++) {
            int x = scan.nextInt();
            if(x == 0){
                os.println(i+1);
                return;
            }
        }
    } Scanner scan = new Scanner(is); scan new Scanner(is) for(int i = 0; i < 5; i++) {
            int x = scan.nextInt();
            if(x == 0){
                os.println(i+1);
                return;
            }
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
            int x = scan.nextInt();
            if(x == 0){
                os.println(i+1);
                return;
            }
        } {
            int x = scan.nextInt();
            if(x == 0){
                os.println(i+1);
                return;
            }
        } int x = scan.nextInt(); x scan.nextInt() scan.nextInt scan if(x == 0){
                os.println(i+1);
                return;
            } x == 0 x 0 {
                os.println(i+1);
                return;
            } os.println(i+1) os.println os i+1 i 1 return; InputStream is is PrintStream os os public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        for(int i = 0; i < 5; i++) {
            int x = scan.nextInt();
            if(x == 0){
                os.println(i+1);
                return;
            }
        }
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        for(int i = 0; i < 5; i++) {
            int x = scan.nextInt();
            if(x == 0){
                os.println(i+1);
                return;
            }
        }
    }
} Main
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        for(int i = 0; i < 5; i++) {
            int x = scan.nextInt();
            if(x == 0){
                os.println(i+1);
                return;
            }
        }
    }
}