import java.util.*;
import java.math.BigDecimal;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n,ans = 0;
      
        for(int i = 1;i <= 5;i++){
			n = sc.nextInt();
          if(n == 0){
            ans = i;
            continue;
          }
        }

        System.out.println(ans);
    }
} import java.util.*; util.* java import java.math.BigDecimal; BigDecimal java.math public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n,ans = 0;
      
        for(int i = 1;i <= 5;i++){
			n = sc.nextInt();
          if(n == 0){
            ans = i;
            continue;
          }
        }

        System.out.println(ans);
    }
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n,ans = 0;
      
        for(int i = 1;i <= 5;i++){
			n = sc.nextInt();
          if(n == 0){
            ans = i;
            continue;
          }
        }

        System.out.println(ans);
    } main {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n,ans = 0;
      
        for(int i = 1;i <= 5;i++){
			n = sc.nextInt();
          if(n == 0){
            ans = i;
            continue;
          }
        }

        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n n ans = 0; ans 0 for(int i = 1;i <= 5;i++){
			n = sc.nextInt();
          if(n == 0){
            ans = i;
            continue;
          }
        } int i = 1; int i = 1; i 1 i <= 5 i 5 i++ i++ i {
			n = sc.nextInt();
          if(n == 0){
            ans = i;
            continue;
          }
        } {
			n = sc.nextInt();
          if(n == 0){
            ans = i;
            continue;
          }
        } n = sc.nextInt() n sc.nextInt() sc.nextInt sc if(n == 0){
            ans = i;
            continue;
          } n == 0 n 0 {
            ans = i;
            continue;
          } ans = i ans i continue; System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n,ans = 0;
      
        for(int i = 1;i <= 5;i++){
			n = sc.nextInt();
          if(n == 0){
            ans = i;
            continue;
          }
        }

        System.out.println(ans);
    }
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n,ans = 0;
      
        for(int i = 1;i <= 5;i++){
			n = sc.nextInt();
          if(n == 0){
            ans = i;
            continue;
          }
        }

        System.out.println(ans);
    }
} Main
import java.util.*;
import java.math.BigDecimal;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n,ans = 0;
      
        for(int i = 1;i <= 5;i++){
			n = sc.nextInt();
          if(n == 0){
            ans = i;
            continue;
          }
        }

        System.out.println(ans);
    }
}