import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int [] a=new int[5];
		int c=0;
		for(int i=0;i<5;i++)
		{
			a[i]=scan.nextInt();
			if(a[i]==0) c=i;
		}
		System.out.println(c+1);

	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int [] a=new int[5];
		int c=0;
		for(int i=0;i<5;i++)
		{
			a[i]=scan.nextInt();
			if(a[i]==0) c=i;
		}
		System.out.println(c+1);

	}

} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int [] a=new int[5];
		int c=0;
		for(int i=0;i<5;i++)
		{
			a[i]=scan.nextInt();
			if(a[i]==0) c=i;
		}
		System.out.println(c+1);

	} main {
		Scanner scan = new Scanner(System.in);
		int [] a=new int[5];
		int c=0;
		for(int i=0;i<5;i++)
		{
			a[i]=scan.nextInt();
			if(a[i]==0) c=i;
		}
		System.out.println(c+1);

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int [] a=new int[5]; a new int[5] 5 int c=0; c 0 for(int i=0;i<5;i++)
		{
			a[i]=scan.nextInt();
			if(a[i]==0) c=i;
		} int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
			a[i]=scan.nextInt();
			if(a[i]==0) c=i;
		} {
			a[i]=scan.nextInt();
			if(a[i]==0) c=i;
		} a[i]=scan.nextInt() a[i] a i scan.nextInt() scan.nextInt scan if(a[i]==0) c=i; a[i]==0 a[i] a i 0 c=i c i System.out.println(c+1) System.out.println System.out System System.out c+1 c 1 String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int [] a=new int[5];
		int c=0;
		for(int i=0;i<5;i++)
		{
			a[i]=scan.nextInt();
			if(a[i]==0) c=i;
		}
		System.out.println(c+1);

	}

} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int [] a=new int[5];
		int c=0;
		for(int i=0;i<5;i++)
		{
			a[i]=scan.nextInt();
			if(a[i]==0) c=i;
		}
		System.out.println(c+1);

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int [] a=new int[5];
		int c=0;
		for(int i=0;i<5;i++)
		{
			a[i]=scan.nextInt();
			if(a[i]==0) c=i;
		}
		System.out.println(c+1);

	}

}
