import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner kb = new Scanner(System.in);
		int x1 = kb.nextInt();
		int x2 = kb.nextInt();
		int x3 = kb.nextInt();
		int x4 = kb.nextInt();
		int x5 = kb.nextInt();
		if (x1 == 0) {
			System.out.println(1);
		} else if (x2 == 0) {
			System.out.println(2);
		} else if (x3 == 0) {
			System.out.println(3);
		} else if (x4 == 0) {
			System.out.println(4);
		} else if (x5 == 0) {
			System.out.println(5);
		}
		kb.close();
	}

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

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner kb = new Scanner(System.in);
		int x1 = kb.nextInt();
		int x2 = kb.nextInt();
		int x3 = kb.nextInt();
		int x4 = kb.nextInt();
		int x5 = kb.nextInt();
		if (x1 == 0) {
			System.out.println(1);
		} else if (x2 == 0) {
			System.out.println(2);
		} else if (x3 == 0) {
			System.out.println(3);
		} else if (x4 == 0) {
			System.out.println(4);
		} else if (x5 == 0) {
			System.out.println(5);
		}
		kb.close();
	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner kb = new Scanner(System.in);
		int x1 = kb.nextInt();
		int x2 = kb.nextInt();
		int x3 = kb.nextInt();
		int x4 = kb.nextInt();
		int x5 = kb.nextInt();
		if (x1 == 0) {
			System.out.println(1);
		} else if (x2 == 0) {
			System.out.println(2);
		} else if (x3 == 0) {
			System.out.println(3);
		} else if (x4 == 0) {
			System.out.println(4);
		} else if (x5 == 0) {
			System.out.println(5);
		}
		kb.close();
	} main {
		// TODO Auto-generated method stub
		Scanner kb = new Scanner(System.in);
		int x1 = kb.nextInt();
		int x2 = kb.nextInt();
		int x3 = kb.nextInt();
		int x4 = kb.nextInt();
		int x5 = kb.nextInt();
		if (x1 == 0) {
			System.out.println(1);
		} else if (x2 == 0) {
			System.out.println(2);
		} else if (x3 == 0) {
			System.out.println(3);
		} else if (x4 == 0) {
			System.out.println(4);
		} else if (x5 == 0) {
			System.out.println(5);
		}
		kb.close();
	} Scanner kb = new Scanner(System.in); kb new Scanner(System.in) int x1 = kb.nextInt(); x1 kb.nextInt() kb.nextInt kb int x2 = kb.nextInt(); x2 kb.nextInt() kb.nextInt kb int x3 = kb.nextInt(); x3 kb.nextInt() kb.nextInt kb int x4 = kb.nextInt(); x4 kb.nextInt() kb.nextInt kb int x5 = kb.nextInt(); x5 kb.nextInt() kb.nextInt kb if (x1 == 0) {
			System.out.println(1);
		} else if (x2 == 0) {
			System.out.println(2);
		} else if (x3 == 0) {
			System.out.println(3);
		} else if (x4 == 0) {
			System.out.println(4);
		} else if (x5 == 0) {
			System.out.println(5);
		} x1 == 0 x1 0 {
			System.out.println(1);
		} System.out.println(1) System.out.println System.out System System.out 1 if (x2 == 0) {
			System.out.println(2);
		} else if (x3 == 0) {
			System.out.println(3);
		} else if (x4 == 0) {
			System.out.println(4);
		} else if (x5 == 0) {
			System.out.println(5);
		} x2 == 0 x2 0 {
			System.out.println(2);
		} System.out.println(2) System.out.println System.out System System.out 2 if (x3 == 0) {
			System.out.println(3);
		} else if (x4 == 0) {
			System.out.println(4);
		} else if (x5 == 0) {
			System.out.println(5);
		} x3 == 0 x3 0 {
			System.out.println(3);
		} System.out.println(3) System.out.println System.out System System.out 3 if (x4 == 0) {
			System.out.println(4);
		} else if (x5 == 0) {
			System.out.println(5);
		} x4 == 0 x4 0 {
			System.out.println(4);
		} System.out.println(4) System.out.println System.out System System.out 4 if (x5 == 0) {
			System.out.println(5);
		} x5 == 0 x5 0 {
			System.out.println(5);
		} System.out.println(5) System.out.println System.out System System.out 5 kb.close() kb.close kb String[] args args public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner kb = new Scanner(System.in);
		int x1 = kb.nextInt();
		int x2 = kb.nextInt();
		int x3 = kb.nextInt();
		int x4 = kb.nextInt();
		int x5 = kb.nextInt();
		if (x1 == 0) {
			System.out.println(1);
		} else if (x2 == 0) {
			System.out.println(2);
		} else if (x3 == 0) {
			System.out.println(3);
		} else if (x4 == 0) {
			System.out.println(4);
		} else if (x5 == 0) {
			System.out.println(5);
		}
		kb.close();
	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner kb = new Scanner(System.in);
		int x1 = kb.nextInt();
		int x2 = kb.nextInt();
		int x3 = kb.nextInt();
		int x4 = kb.nextInt();
		int x5 = kb.nextInt();
		if (x1 == 0) {
			System.out.println(1);
		} else if (x2 == 0) {
			System.out.println(2);
		} else if (x3 == 0) {
			System.out.println(3);
		} else if (x4 == 0) {
			System.out.println(4);
		} else if (x5 == 0) {
			System.out.println(5);
		}
		kb.close();
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner kb = new Scanner(System.in);
		int x1 = kb.nextInt();
		int x2 = kb.nextInt();
		int x3 = kb.nextInt();
		int x4 = kb.nextInt();
		int x5 = kb.nextInt();
		if (x1 == 0) {
			System.out.println(1);
		} else if (x2 == 0) {
			System.out.println(2);
		} else if (x3 == 0) {
			System.out.println(3);
		} else if (x4 == 0) {
			System.out.println(4);
		} else if (x5 == 0) {
			System.out.println(5);
		}
		kb.close();
	}

}
