import java.util.Scanner;
public class Main {

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

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

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

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

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

} public class Main {

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

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

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

}