import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		String[] tmp = scanner.nextLine().split(" ");

		int ans = 0;
		for(int i = 0; i < 5; i++){

			if(Integer.parseInt(tmp[i]) == 0) {
				ans = i + 1; break;
			}

		}

			System.out.println(ans);

	}

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

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		String[] tmp = scanner.nextLine().split(" ");

		int ans = 0;
		for(int i = 0; i < 5; i++){

			if(Integer.parseInt(tmp[i]) == 0) {
				ans = i + 1; break;
			}

		}

			System.out.println(ans);

	}

} Main public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		String[] tmp = scanner.nextLine().split(" ");

		int ans = 0;
		for(int i = 0; i < 5; i++){

			if(Integer.parseInt(tmp[i]) == 0) {
				ans = i + 1; break;
			}

		}

			System.out.println(ans);

	} main {

		Scanner scanner = new Scanner(System.in);

		String[] tmp = scanner.nextLine().split(" ");

		int ans = 0;
		for(int i = 0; i < 5; i++){

			if(Integer.parseInt(tmp[i]) == 0) {
				ans = i + 1; break;
			}

		}

			System.out.println(ans);

	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String[] tmp = scanner.nextLine().split(" "); tmp scanner.nextLine().split(" ") scanner.nextLine().split scanner.nextLine() scanner.nextLine scanner " " int ans = 0; ans 0 for(int i = 0; i < 5; i++){

			if(Integer.parseInt(tmp[i]) == 0) {
				ans = i + 1; break;
			}

		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {

			if(Integer.parseInt(tmp[i]) == 0) {
				ans = i + 1; break;
			}

		} {

			if(Integer.parseInt(tmp[i]) == 0) {
				ans = i + 1; break;
			}

		} if(Integer.parseInt(tmp[i]) == 0) {
				ans = i + 1; break;
			} Integer.parseInt(tmp[i]) == 0 Integer.parseInt(tmp[i]) Integer.parseInt Integer tmp[i] tmp i 0 {
				ans = i + 1; break;
			} ans = i + 1 ans i + 1 i 1 break; System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		String[] tmp = scanner.nextLine().split(" ");

		int ans = 0;
		for(int i = 0; i < 5; i++){

			if(Integer.parseInt(tmp[i]) == 0) {
				ans = i + 1; break;
			}

		}

			System.out.println(ans);

	}

} public class Main{

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		String[] tmp = scanner.nextLine().split(" ");

		int ans = 0;
		for(int i = 0; i < 5; i++){

			if(Integer.parseInt(tmp[i]) == 0) {
				ans = i + 1; break;
			}

		}

			System.out.println(ans);

	}

} Main
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		String[] tmp = scanner.nextLine().split(" ");

		int ans = 0;
		for(int i = 0; i < 5; i++){

			if(Integer.parseInt(tmp[i]) == 0) {
				ans = i + 1; break;
			}

		}

			System.out.println(ans);

	}

}
