import java.util.*;


class Main{
  public static void main(String[] args){
    		Scanner sc = new Scanner(System.in);
		
		int[] x= new int[5];
		
		for (int i = 0; i < 5; i++) {
		   x[i] = sc.nextInt();
		}
		
		int t = 0;
		int i = 0;
		
		do {
			if ( x[i] == 0)
			{
				t = 1;
				//System.out.println("x[i] = "+ x[i]);
			}
			else
			{
				i++;
			}
			
		}while(t == 0);
		
		System.out.println(i+1);
  }
} import java.util.*; util.* java class Main{
  public static void main(String[] args){
    		Scanner sc = new Scanner(System.in);
		
		int[] x= new int[5];
		
		for (int i = 0; i < 5; i++) {
		   x[i] = sc.nextInt();
		}
		
		int t = 0;
		int i = 0;
		
		do {
			if ( x[i] == 0)
			{
				t = 1;
				//System.out.println("x[i] = "+ x[i]);
			}
			else
			{
				i++;
			}
			
		}while(t == 0);
		
		System.out.println(i+1);
  }
} Main public static void main(String[] args){
    		Scanner sc = new Scanner(System.in);
		
		int[] x= new int[5];
		
		for (int i = 0; i < 5; i++) {
		   x[i] = sc.nextInt();
		}
		
		int t = 0;
		int i = 0;
		
		do {
			if ( x[i] == 0)
			{
				t = 1;
				//System.out.println("x[i] = "+ x[i]);
			}
			else
			{
				i++;
			}
			
		}while(t == 0);
		
		System.out.println(i+1);
  } main {
    		Scanner sc = new Scanner(System.in);
		
		int[] x= new int[5];
		
		for (int i = 0; i < 5; i++) {
		   x[i] = sc.nextInt();
		}
		
		int t = 0;
		int i = 0;
		
		do {
			if ( x[i] == 0)
			{
				t = 1;
				//System.out.println("x[i] = "+ x[i]);
			}
			else
			{
				i++;
			}
			
		}while(t == 0);
		
		System.out.println(i+1);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] x= new int[5]; x new int[5] 5 for (int i = 0; i < 5; i++) {
		   x[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
		   x[i] = sc.nextInt();
		} {
		   x[i] = sc.nextInt();
		} x[i] = sc.nextInt() x[i] x i sc.nextInt() sc.nextInt sc int t = 0; t 0 int i = 0; i 0 do {
			if ( x[i] == 0)
			{
				t = 1;
				//System.out.println("x[i] = "+ x[i]);
			}
			else
			{
				i++;
			}
			
		}while(t == 0); t == 0 t 0 {
			if ( x[i] == 0)
			{
				t = 1;
				//System.out.println("x[i] = "+ x[i]);
			}
			else
			{
				i++;
			}
			
		} if ( x[i] == 0)
			{
				t = 1;
				//System.out.println("x[i] = "+ x[i]);
			}
			else
			{
				i++;
			} x[i] == 0 x[i] x i 0 {
				t = 1;
				//System.out.println("x[i] = "+ x[i]);
			} t = 1 t 1 {
				i++;
			} i++ i System.out.println(i+1) System.out.println System.out System System.out i+1 i 1 String[] args args
import java.util.*;


class Main{
  public static void main(String[] args){
    		Scanner sc = new Scanner(System.in);
		
		int[] x= new int[5];
		
		for (int i = 0; i < 5; i++) {
		   x[i] = sc.nextInt();
		}
		
		int t = 0;
		int i = 0;
		
		do {
			if ( x[i] == 0)
			{
				t = 1;
				//System.out.println("x[i] = "+ x[i]);
			}
			else
			{
				i++;
			}
			
		}while(t == 0);
		
		System.out.println(i+1);
  }
}