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