import java.util.Scanner;

public class Main {

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

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

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

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

public class Main {

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