import java.util.*;

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

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