import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x[] = new int[5];
		boolean bl = false;
		for(int i = 0; i < x.length; i++) {
			x[i] = sc.nextInt();
			if(x[i] == 0) {
				System.out.println(i + 1);
				bl = true;
			}
		}
		if(!bl)
			System.out.println("0");
	}
} 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];
		boolean bl = false;
		for(int i = 0; i < x.length; i++) {
			x[i] = sc.nextInt();
			if(x[i] == 0) {
				System.out.println(i + 1);
				bl = true;
			}
		}
		if(!bl)
			System.out.println("0");
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x[] = new int[5];
		boolean bl = false;
		for(int i = 0; i < x.length; i++) {
			x[i] = sc.nextInt();
			if(x[i] == 0) {
				System.out.println(i + 1);
				bl = true;
			}
		}
		if(!bl)
			System.out.println("0");
	} main {
		Scanner sc = new Scanner(System.in);
		int x[] = new int[5];
		boolean bl = false;
		for(int i = 0; i < x.length; i++) {
			x[i] = sc.nextInt();
			if(x[i] == 0) {
				System.out.println(i + 1);
				bl = true;
			}
		}
		if(!bl)
			System.out.println("0");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x[] = new int[5]; x new int[5] 5 boolean bl = false; bl false for(int i = 0; i < x.length; i++) {
			x[i] = sc.nextInt();
			if(x[i] == 0) {
				System.out.println(i + 1);
				bl = true;
			}
		} int i = 0; int i = 0; i 0 i < x.length i x.length x x.length i++ i++ i {
			x[i] = sc.nextInt();
			if(x[i] == 0) {
				System.out.println(i + 1);
				bl = true;
			}
		} {
			x[i] = sc.nextInt();
			if(x[i] == 0) {
				System.out.println(i + 1);
				bl = true;
			}
		} x[i] = sc.nextInt() x[i] x i sc.nextInt() sc.nextInt sc if(x[i] == 0) {
				System.out.println(i + 1);
				bl = true;
			} x[i] == 0 x[i] x i 0 {
				System.out.println(i + 1);
				bl = true;
			} System.out.println(i + 1) System.out.println System.out System System.out i + 1 i 1 bl = true bl true if(!bl)
			System.out.println("0"); !bl bl System.out.println("0") System.out.println System.out System System.out "0" String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x[] = new int[5];
		boolean bl = false;
		for(int i = 0; i < x.length; i++) {
			x[i] = sc.nextInt();
			if(x[i] == 0) {
				System.out.println(i + 1);
				bl = true;
			}
		}
		if(!bl)
			System.out.println("0");
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x[] = new int[5];
		boolean bl = false;
		for(int i = 0; i < x.length; i++) {
			x[i] = sc.nextInt();
			if(x[i] == 0) {
				System.out.println(i + 1);
				bl = true;
			}
		}
		if(!bl)
			System.out.println("0");
	}
} 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];
		boolean bl = false;
		for(int i = 0; i < x.length; i++) {
			x[i] = sc.nextInt();
			if(x[i] == 0) {
				System.out.println(i + 1);
				bl = true;
			}
		}
		if(!bl)
			System.out.println("0");
	}
}
