import java.util.Scanner;

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

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