import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		for(int i=1;i<=5;i++) {
			int a = scan.nextInt();
			if(a==0) {
				System.out.println(i);
				System.exit(0);
			}
		}
		
	}	
}
  import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		for(int i=1;i<=5;i++) {
			int a = scan.nextInt();
			if(a==0) {
				System.out.println(i);
				System.exit(0);
			}
		}
		
	}	
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		for(int i=1;i<=5;i++) {
			int a = scan.nextInt();
			if(a==0) {
				System.out.println(i);
				System.exit(0);
			}
		}
		
	} main {
		Scanner scan = new Scanner(System.in);
		
		for(int i=1;i<=5;i++) {
			int a = scan.nextInt();
			if(a==0) {
				System.out.println(i);
				System.exit(0);
			}
		}
		
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) for(int i=1;i<=5;i++) {
			int a = scan.nextInt();
			if(a==0) {
				System.out.println(i);
				System.exit(0);
			}
		} int i=1; int i=1; i 1 i<=5 i 5 i++ i++ i {
			int a = scan.nextInt();
			if(a==0) {
				System.out.println(i);
				System.exit(0);
			}
		} {
			int a = scan.nextInt();
			if(a==0) {
				System.out.println(i);
				System.exit(0);
			}
		} int a = scan.nextInt(); a scan.nextInt() scan.nextInt scan if(a==0) {
				System.out.println(i);
				System.exit(0);
			} a==0 a 0 {
				System.out.println(i);
				System.exit(0);
			} System.out.println(i) System.out.println System.out System System.out i System.exit(0) System.exit System 0 String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		for(int i=1;i<=5;i++) {
			int a = scan.nextInt();
			if(a==0) {
				System.out.println(i);
				System.exit(0);
			}
		}
		
	}	
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		for(int i=1;i<=5;i++) {
			int a = scan.nextInt();
			if(a==0) {
				System.out.println(i);
				System.exit(0);
			}
		}
		
	}	
} Main
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		for(int i=1;i<=5;i++) {
			int a = scan.nextInt();
			if(a==0) {
				System.out.println(i);
				System.exit(0);
			}
		}
		
	}	
}
 
