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