import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {

	public static void main(String[] args)throws java.lang.Exception
    {		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int a[]=new int[5],p=0;
		StringTokenizer st = new StringTokenizer(br.readLine());
		for(int i=0; i<5; i++) {
			a[i]=Integer.parseInt(st.nextToken());
			if(a[i]==0) p=i+1;
		}
		System.out.println(p);
	}

} import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java public class Main {

	public static void main(String[] args)throws java.lang.Exception
    {		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int a[]=new int[5],p=0;
		StringTokenizer st = new StringTokenizer(br.readLine());
		for(int i=0; i<5; i++) {
			a[i]=Integer.parseInt(st.nextToken());
			if(a[i]==0) p=i+1;
		}
		System.out.println(p);
	}

} Main public static void main(String[] args)throws java.lang.Exception
    {		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int a[]=new int[5],p=0;
		StringTokenizer st = new StringTokenizer(br.readLine());
		for(int i=0; i<5; i++) {
			a[i]=Integer.parseInt(st.nextToken());
			if(a[i]==0) p=i+1;
		}
		System.out.println(p);
	} main {		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int a[]=new int[5],p=0;
		StringTokenizer st = new StringTokenizer(br.readLine());
		for(int i=0; i<5; i++) {
			a[i]=Integer.parseInt(st.nextToken());
			if(a[i]==0) p=i+1;
		}
		System.out.println(p);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int a[]=new int[5] a new int[5] 5 p=0; p 0 StringTokenizer st = new StringTokenizer(br.readLine()); st new StringTokenizer(br.readLine()) for(int i=0; i<5; i++) {
			a[i]=Integer.parseInt(st.nextToken());
			if(a[i]==0) p=i+1;
		} int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
			a[i]=Integer.parseInt(st.nextToken());
			if(a[i]==0) p=i+1;
		} {
			a[i]=Integer.parseInt(st.nextToken());
			if(a[i]==0) p=i+1;
		} a[i]=Integer.parseInt(st.nextToken()) a[i] a i Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st if(a[i]==0) p=i+1; a[i]==0 a[i] a i 0 p=i+1 p i+1 i 1 System.out.println(p) System.out.println System.out System System.out p String[] args args public class Main {

	public static void main(String[] args)throws java.lang.Exception
    {		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int a[]=new int[5],p=0;
		StringTokenizer st = new StringTokenizer(br.readLine());
		for(int i=0; i<5; i++) {
			a[i]=Integer.parseInt(st.nextToken());
			if(a[i]==0) p=i+1;
		}
		System.out.println(p);
	}

} public class Main {

	public static void main(String[] args)throws java.lang.Exception
    {		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int a[]=new int[5],p=0;
		StringTokenizer st = new StringTokenizer(br.readLine());
		for(int i=0; i<5; i++) {
			a[i]=Integer.parseInt(st.nextToken());
			if(a[i]==0) p=i+1;
		}
		System.out.println(p);
	}

} Main
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {

	public static void main(String[] args)throws java.lang.Exception
    {		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int a[]=new int[5],p=0;
		StringTokenizer st = new StringTokenizer(br.readLine());
		for(int i=0; i<5; i++) {
			a[i]=Integer.parseInt(st.nextToken());
			if(a[i]==0) p=i+1;
		}
		System.out.println(p);
	}

}
