import java.util.*;

public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		int[] A = new int[5];
		
		for(int i=0; i<5; i++) {
			A[i] = keyboard.nextInt();
		}
		
		int ans =0;
		for(int j=0; j<5; j++) {
			if(A[j] == 0) {
				ans = j+1;
				break;
			}
		}
		
		System.out.println(ans);
		keyboard.close();	
	}
} import java.util.*; util.* java public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		int[] A = new int[5];
		
		for(int i=0; i<5; i++) {
			A[i] = keyboard.nextInt();
		}
		
		int ans =0;
		for(int j=0; j<5; j++) {
			if(A[j] == 0) {
				ans = j+1;
				break;
			}
		}
		
		System.out.println(ans);
		keyboard.close();	
	}
} Main public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		int[] A = new int[5];
		
		for(int i=0; i<5; i++) {
			A[i] = keyboard.nextInt();
		}
		
		int ans =0;
		for(int j=0; j<5; j++) {
			if(A[j] == 0) {
				ans = j+1;
				break;
			}
		}
		
		System.out.println(ans);
		keyboard.close();	
	} main {
		
		Scanner keyboard = new Scanner(System.in); 
		
		int[] A = new int[5];
		
		for(int i=0; i<5; i++) {
			A[i] = keyboard.nextInt();
		}
		
		int ans =0;
		for(int j=0; j<5; j++) {
			if(A[j] == 0) {
				ans = j+1;
				break;
			}
		}
		
		System.out.println(ans);
		keyboard.close();	
	} Scanner keyboard = new Scanner(System.in); keyboard new Scanner(System.in) int[] A = new int[5]; A new int[5] 5 for(int i=0; i<5; i++) {
			A[i] = keyboard.nextInt();
		} int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
			A[i] = keyboard.nextInt();
		} {
			A[i] = keyboard.nextInt();
		} A[i] = keyboard.nextInt() A[i] A i keyboard.nextInt() keyboard.nextInt keyboard int ans =0; ans 0 for(int j=0; j<5; j++) {
			if(A[j] == 0) {
				ans = j+1;
				break;
			}
		} int j=0; int j=0; j 0 j<5 j 5 j++ j++ j {
			if(A[j] == 0) {
				ans = j+1;
				break;
			}
		} {
			if(A[j] == 0) {
				ans = j+1;
				break;
			}
		} if(A[j] == 0) {
				ans = j+1;
				break;
			} A[j] == 0 A[j] A j 0 {
				ans = j+1;
				break;
			} ans = j+1 ans j+1 j 1 break; System.out.println(ans) System.out.println System.out System System.out ans keyboard.close() keyboard.close keyboard String[] args args public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		int[] A = new int[5];
		
		for(int i=0; i<5; i++) {
			A[i] = keyboard.nextInt();
		}
		
		int ans =0;
		for(int j=0; j<5; j++) {
			if(A[j] == 0) {
				ans = j+1;
				break;
			}
		}
		
		System.out.println(ans);
		keyboard.close();	
	}
} public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		int[] A = new int[5];
		
		for(int i=0; i<5; i++) {
			A[i] = keyboard.nextInt();
		}
		
		int ans =0;
		for(int j=0; j<5; j++) {
			if(A[j] == 0) {
				ans = j+1;
				break;
			}
		}
		
		System.out.println(ans);
		keyboard.close();	
	}
} Main
import java.util.*;

public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		int[] A = new int[5];
		
		for(int i=0; i<5; i++) {
			A[i] = keyboard.nextInt();
		}
		
		int ans =0;
		for(int j=0; j<5; j++) {
			if(A[j] == 0) {
				ans = j+1;
				break;
			}
		}
		
		System.out.println(ans);
		keyboard.close();	
	}
}
