import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		List<Integer> nums = new ArrayList<Integer>();
		for(int i = 0; i < 5; i++) {
			nums.add(scanner.nextInt());
			if(nums.get(i) == 0) {
				System.out.println(i + 1);
				break;
			}
		}
		scanner.close();
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		List<Integer> nums = new ArrayList<Integer>();
		for(int i = 0; i < 5; i++) {
			nums.add(scanner.nextInt());
			if(nums.get(i) == 0) {
				System.out.println(i + 1);
				break;
			}
		}
		scanner.close();
	}
} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		List<Integer> nums = new ArrayList<Integer>();
		for(int i = 0; i < 5; i++) {
			nums.add(scanner.nextInt());
			if(nums.get(i) == 0) {
				System.out.println(i + 1);
				break;
			}
		}
		scanner.close();
	} main {
		Scanner scanner = new Scanner(System.in);
		List<Integer> nums = new ArrayList<Integer>();
		for(int i = 0; i < 5; i++) {
			nums.add(scanner.nextInt());
			if(nums.get(i) == 0) {
				System.out.println(i + 1);
				break;
			}
		}
		scanner.close();
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) List<Integer> nums = new ArrayList<Integer>(); nums new ArrayList<Integer>() for(int i = 0; i < 5; i++) {
			nums.add(scanner.nextInt());
			if(nums.get(i) == 0) {
				System.out.println(i + 1);
				break;
			}
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			nums.add(scanner.nextInt());
			if(nums.get(i) == 0) {
				System.out.println(i + 1);
				break;
			}
		} {
			nums.add(scanner.nextInt());
			if(nums.get(i) == 0) {
				System.out.println(i + 1);
				break;
			}
		} nums.add(scanner.nextInt()) nums.add nums scanner.nextInt() scanner.nextInt scanner if(nums.get(i) == 0) {
				System.out.println(i + 1);
				break;
			} nums.get(i) == 0 nums.get(i) nums.get nums i 0 {
				System.out.println(i + 1);
				break;
			} System.out.println(i + 1) System.out.println System.out System System.out i + 1 i 1 break; scanner.close() scanner.close scanner String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		List<Integer> nums = new ArrayList<Integer>();
		for(int i = 0; i < 5; i++) {
			nums.add(scanner.nextInt());
			if(nums.get(i) == 0) {
				System.out.println(i + 1);
				break;
			}
		}
		scanner.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		List<Integer> nums = new ArrayList<Integer>();
		for(int i = 0; i < 5; i++) {
			nums.add(scanner.nextInt());
			if(nums.get(i) == 0) {
				System.out.println(i + 1);
				break;
			}
		}
		scanner.close();
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		List<Integer> nums = new ArrayList<Integer>();
		for(int i = 0; i < 5; i++) {
			nums.add(scanner.nextInt());
			if(nums.get(i) == 0) {
				System.out.println(i + 1);
				break;
			}
		}
		scanner.close();
	}
}