import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int num = 1;
		for (int i=0; i<5; i++) {
			int x = sc.nextInt();
			if (x==0) {
				break;
			}
			num++;
		}				
		System.out.print(num);
		sc.close();
	}

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

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int num = 1;
		for (int i=0; i<5; i++) {
			int x = sc.nextInt();
			if (x==0) {
				break;
			}
			num++;
		}				
		System.out.print(num);
		sc.close();
	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int num = 1;
		for (int i=0; i<5; i++) {
			int x = sc.nextInt();
			if (x==0) {
				break;
			}
			num++;
		}				
		System.out.print(num);
		sc.close();
	} main {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int num = 1;
		for (int i=0; i<5; i++) {
			int x = sc.nextInt();
			if (x==0) {
				break;
			}
			num++;
		}				
		System.out.print(num);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int num = 1; num 1 for (int i=0; i<5; i++) {
			int x = sc.nextInt();
			if (x==0) {
				break;
			}
			num++;
		} int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
			int x = sc.nextInt();
			if (x==0) {
				break;
			}
			num++;
		} {
			int x = sc.nextInt();
			if (x==0) {
				break;
			}
			num++;
		} int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc if (x==0) {
				break;
			} x==0 x 0 {
				break;
			} break; num++ num System.out.print(num) System.out.print System.out System System.out num sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int num = 1;
		for (int i=0; i<5; i++) {
			int x = sc.nextInt();
			if (x==0) {
				break;
			}
			num++;
		}				
		System.out.print(num);
		sc.close();
	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int num = 1;
		for (int i=0; i<5; i++) {
			int x = sc.nextInt();
			if (x==0) {
				break;
			}
			num++;
		}				
		System.out.print(num);
		sc.close();
	}

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

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int num = 1;
		for (int i=0; i<5; i++) {
			int x = sc.nextInt();
			if (x==0) {
				break;
			}
			num++;
		}				
		System.out.print(num);
		sc.close();
	}

}
