import java.util.Scanner;
// A - Multiplication 1
class Main{
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		int E = sc.nextInt();

		int ans;

		if (A == 0) {
			System.out.println("1");
		}
		if (B == 0) {
			System.out.println("2");
		}
		if (C == 0) {
			System.out.println("3");
		}
		if (D == 0) {
			System.out.println("4");
		}
		if (E == 0) {
			System.out.println("5");
		}

	}
} import java.util.Scanner; Scanner java.util class Main{
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		int E = sc.nextInt();

		int ans;

		if (A == 0) {
			System.out.println("1");
		}
		if (B == 0) {
			System.out.println("2");
		}
		if (C == 0) {
			System.out.println("3");
		}
		if (D == 0) {
			System.out.println("4");
		}
		if (E == 0) {
			System.out.println("5");
		}

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

		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		int E = sc.nextInt();

		int ans;

		if (A == 0) {
			System.out.println("1");
		}
		if (B == 0) {
			System.out.println("2");
		}
		if (C == 0) {
			System.out.println("3");
		}
		if (D == 0) {
			System.out.println("4");
		}
		if (E == 0) {
			System.out.println("5");
		}

	} main {

		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		int E = sc.nextInt();

		int ans;

		if (A == 0) {
			System.out.println("1");
		}
		if (B == 0) {
			System.out.println("2");
		}
		if (C == 0) {
			System.out.println("3");
		}
		if (D == 0) {
			System.out.println("4");
		}
		if (E == 0) {
			System.out.println("5");
		}

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int A = sc.nextInt(); A sc.nextInt() sc.nextInt sc int B = sc.nextInt(); B sc.nextInt() sc.nextInt sc int C = sc.nextInt(); C sc.nextInt() sc.nextInt sc int D = sc.nextInt(); D sc.nextInt() sc.nextInt sc int E = sc.nextInt(); E sc.nextInt() sc.nextInt sc int ans; ans if (A == 0) {
			System.out.println("1");
		} A == 0 A 0 {
			System.out.println("1");
		} System.out.println("1") System.out.println System.out System System.out "1" if (B == 0) {
			System.out.println("2");
		} B == 0 B 0 {
			System.out.println("2");
		} System.out.println("2") System.out.println System.out System System.out "2" if (C == 0) {
			System.out.println("3");
		} C == 0 C 0 {
			System.out.println("3");
		} System.out.println("3") System.out.println System.out System System.out "3" if (D == 0) {
			System.out.println("4");
		} D == 0 D 0 {
			System.out.println("4");
		} System.out.println("4") System.out.println System.out System System.out "4" if (E == 0) {
			System.out.println("5");
		} E == 0 E 0 {
			System.out.println("5");
		} System.out.println("5") System.out.println System.out System System.out "5" String[] args args
import java.util.Scanner;
// A - Multiplication 1
class Main{
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		int E = sc.nextInt();

		int ans;

		if (A == 0) {
			System.out.println("1");
		}
		if (B == 0) {
			System.out.println("2");
		}
		if (C == 0) {
			System.out.println("3");
		}
		if (D == 0) {
			System.out.println("4");
		}
		if (E == 0) {
			System.out.println("5");
		}

	}
}