import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Stack;

/*
 * @author Tanzim Ibn Patowary
 * Created  May 29, 2020 9:22:05 PM
 */
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		for (int i = 0; i < 5; i++) {
			int x = in.nextInt();
			if (x==0) {
				System.out.println(i+1);
				break;
			}
		}
	}
} import java.math.BigInteger; BigInteger java.math import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.HashSet; HashSet java.util import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		for (int i = 0; i < 5; i++) {
			int x = in.nextInt();
			if (x==0) {
				System.out.println(i+1);
				break;
			}
		}
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		for (int i = 0; i < 5; i++) {
			int x = in.nextInt();
			if (x==0) {
				System.out.println(i+1);
				break;
			}
		}
	} main {
		Scanner in = new Scanner(System.in);
		for (int i = 0; i < 5; i++) {
			int x = in.nextInt();
			if (x==0) {
				System.out.println(i+1);
				break;
			}
		}
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) for (int i = 0; i < 5; i++) {
			int x = in.nextInt();
			if (x==0) {
				System.out.println(i+1);
				break;
			}
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			int x = in.nextInt();
			if (x==0) {
				System.out.println(i+1);
				break;
			}
		} {
			int x = in.nextInt();
			if (x==0) {
				System.out.println(i+1);
				break;
			}
		} int x = in.nextInt(); x in.nextInt() in.nextInt in if (x==0) {
				System.out.println(i+1);
				break;
			} x==0 x 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; String[] args args public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		for (int i = 0; i < 5; i++) {
			int x = in.nextInt();
			if (x==0) {
				System.out.println(i+1);
				break;
			}
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		for (int i = 0; i < 5; i++) {
			int x = in.nextInt();
			if (x==0) {
				System.out.println(i+1);
				break;
			}
		}
	}
} Main
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Stack;

/*
 * @author Tanzim Ibn Patowary
 * Created  May 29, 2020 9:22:05 PM
 */
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		for (int i = 0; i < 5; i++) {
			int x = in.nextInt();
			if (x==0) {
				System.out.println(i+1);
				break;
			}
		}
	}
}