import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = 5;
		int[] a = new int[n];
      	int num=0;
		for(int i=0; i<a.length; i++){
			a[i] = scn.nextInt();
          	if(a[i]==0) num=i+1;
		}
      	System.out.println(num);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = 5;
		int[] a = new int[n];
      	int num=0;
		for(int i=0; i<a.length; i++){
			a[i] = scn.nextInt();
          	if(a[i]==0) num=i+1;
		}
      	System.out.println(num);
	}
} Main public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = 5;
		int[] a = new int[n];
      	int num=0;
		for(int i=0; i<a.length; i++){
			a[i] = scn.nextInt();
          	if(a[i]==0) num=i+1;
		}
      	System.out.println(num);
	} main {
		Scanner scn = new Scanner(System.in);
		int n = 5;
		int[] a = new int[n];
      	int num=0;
		for(int i=0; i<a.length; i++){
			a[i] = scn.nextInt();
          	if(a[i]==0) num=i+1;
		}
      	System.out.println(num);
	} Scanner scn = new Scanner(System.in); scn new Scanner(System.in) int n = 5; n 5 int[] a = new int[n]; a new int[n] n int num=0; num 0 for(int i=0; i<a.length; i++){
			a[i] = scn.nextInt();
          	if(a[i]==0) num=i+1;
		} int i=0; int i=0; i 0 i<a.length i a.length a a.length i++ i++ i {
			a[i] = scn.nextInt();
          	if(a[i]==0) num=i+1;
		} {
			a[i] = scn.nextInt();
          	if(a[i]==0) num=i+1;
		} a[i] = scn.nextInt() a[i] a i scn.nextInt() scn.nextInt scn if(a[i]==0) num=i+1; a[i]==0 a[i] a i 0 num=i+1 num i+1 i 1 System.out.println(num) System.out.println System.out System System.out num String[] args args public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = 5;
		int[] a = new int[n];
      	int num=0;
		for(int i=0; i<a.length; i++){
			a[i] = scn.nextInt();
          	if(a[i]==0) num=i+1;
		}
      	System.out.println(num);
	}
} public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = 5;
		int[] a = new int[n];
      	int num=0;
		for(int i=0; i<a.length; i++){
			a[i] = scn.nextInt();
          	if(a[i]==0) num=i+1;
		}
      	System.out.println(num);
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = 5;
		int[] a = new int[n];
      	int num=0;
		for(int i=0; i<a.length; i++){
			a[i] = scn.nextInt();
          	if(a[i]==0) num=i+1;
		}
      	System.out.println(num);
	}
}