import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int[] nums = new int[5];

		for (int i=0; i<5; i++) {
			int c = sc.nextInt();
			nums[i] = c;
		}


		int index=1;
		for (int i=0; i<5; i++) {
			if (nums[i]==0) {
				index = i+1;
				break;
			}
		}
		System.out.println(index);
	}

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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int[] nums = new int[5];

		for (int i=0; i<5; i++) {
			int c = sc.nextInt();
			nums[i] = c;
		}


		int index=1;
		for (int i=0; i<5; i++) {
			if (nums[i]==0) {
				index = i+1;
				break;
			}
		}
		System.out.println(index);
	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int[] nums = new int[5];

		for (int i=0; i<5; i++) {
			int c = sc.nextInt();
			nums[i] = c;
		}


		int index=1;
		for (int i=0; i<5; i++) {
			if (nums[i]==0) {
				index = i+1;
				break;
			}
		}
		System.out.println(index);
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int[] nums = new int[5];

		for (int i=0; i<5; i++) {
			int c = sc.nextInt();
			nums[i] = c;
		}


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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int[] nums = new int[5];

		for (int i=0; i<5; i++) {
			int c = sc.nextInt();
			nums[i] = c;
		}


		int index=1;
		for (int i=0; i<5; i++) {
			if (nums[i]==0) {
				index = i+1;
				break;
			}
		}
		System.out.println(index);
	}

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int[] nums = new int[5];

		for (int i=0; i<5; i++) {
			int c = sc.nextInt();
			nums[i] = c;
		}


		int index=1;
		for (int i=0; i<5; i++) {
			if (nums[i]==0) {
				index = i+1;
				break;
			}
		}
		System.out.println(index);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int[] nums = new int[5];

		for (int i=0; i<5; i++) {
			int c = sc.nextInt();
			nums[i] = c;
		}


		int index=1;
		for (int i=0; i<5; i++) {
			if (nums[i]==0) {
				index = i+1;
				break;
			}
		}
		System.out.println(index);
	}

}