import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[5];
		a[0] = sc.nextInt();
		a[1] = sc.nextInt();
		a[2] = sc.nextInt();
		a[3] = sc.nextInt();
		a[4] = sc.nextInt();
		int b = 0;
		for(int i=0; i<5; i++) {
			if(a[i]==0) {
				b = i+1;
			}
		}
		sc.close();
		System.out.println(b);
	}

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[5];
		a[0] = sc.nextInt();
		a[1] = sc.nextInt();
		a[2] = sc.nextInt();
		a[3] = sc.nextInt();
		a[4] = sc.nextInt();
		int b = 0;
		for(int i=0; i<5; i++) {
			if(a[i]==0) {
				b = i+1;
			}
		}
		sc.close();
		System.out.println(b);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[5];
		a[0] = sc.nextInt();
		a[1] = sc.nextInt();
		a[2] = sc.nextInt();
		a[3] = sc.nextInt();
		a[4] = sc.nextInt();
		int b = 0;
		for(int i=0; i<5; i++) {
			if(a[i]==0) {
				b = i+1;
			}
		}
		sc.close();
		System.out.println(b);
	} main {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[5];
		a[0] = sc.nextInt();
		a[1] = sc.nextInt();
		a[2] = sc.nextInt();
		a[3] = sc.nextInt();
		a[4] = sc.nextInt();
		int b = 0;
		for(int i=0; i<5; i++) {
			if(a[i]==0) {
				b = i+1;
			}
		}
		sc.close();
		System.out.println(b);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] a = new int[5]; a new int[5] 5 a[0] = sc.nextInt() a[0] a 0 sc.nextInt() sc.nextInt sc a[1] = sc.nextInt() a[1] a 1 sc.nextInt() sc.nextInt sc a[2] = sc.nextInt() a[2] a 2 sc.nextInt() sc.nextInt sc a[3] = sc.nextInt() a[3] a 3 sc.nextInt() sc.nextInt sc a[4] = sc.nextInt() a[4] a 4 sc.nextInt() sc.nextInt sc int b = 0; b 0 for(int i=0; i<5; i++) {
			if(a[i]==0) {
				b = i+1;
			}
		} int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
			if(a[i]==0) {
				b = i+1;
			}
		} {
			if(a[i]==0) {
				b = i+1;
			}
		} if(a[i]==0) {
				b = i+1;
			} a[i]==0 a[i] a i 0 {
				b = i+1;
			} b = i+1 b i+1 i 1 sc.close() sc.close sc System.out.println(b) System.out.println System.out System System.out b String[] args args public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[5];
		a[0] = sc.nextInt();
		a[1] = sc.nextInt();
		a[2] = sc.nextInt();
		a[3] = sc.nextInt();
		a[4] = sc.nextInt();
		int b = 0;
		for(int i=0; i<5; i++) {
			if(a[i]==0) {
				b = i+1;
			}
		}
		sc.close();
		System.out.println(b);
	}

} public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[5];
		a[0] = sc.nextInt();
		a[1] = sc.nextInt();
		a[2] = sc.nextInt();
		a[3] = sc.nextInt();
		a[4] = sc.nextInt();
		int b = 0;
		for(int i=0; i<5; i++) {
			if(a[i]==0) {
				b = i+1;
			}
		}
		sc.close();
		System.out.println(b);
	}

} Main
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[5];
		a[0] = sc.nextInt();
		a[1] = sc.nextInt();
		a[2] = sc.nextInt();
		a[3] = sc.nextInt();
		a[4] = sc.nextInt();
		int b = 0;
		for(int i=0; i<5; i++) {
			if(a[i]==0) {
				b = i+1;
			}
		}
		sc.close();
		System.out.println(b);
	}

}