import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = 0;
        int g=0;
      for (int i=1;i<=5;i++)
      {
          a=in.nextInt();
          if (a==0)
          {
           g=i;
          }
         


        }
      System.out.print(g);

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


        }
      System.out.print(g);

    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = 0;
        int g=0;
      for (int i=1;i<=5;i++)
      {
          a=in.nextInt();
          if (a==0)
          {
           g=i;
          }
         


        }
      System.out.print(g);

    } main {
        Scanner in = new Scanner(System.in);
        int a = 0;
        int g=0;
      for (int i=1;i<=5;i++)
      {
          a=in.nextInt();
          if (a==0)
          {
           g=i;
          }
         


        }
      System.out.print(g);

    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int a = 0; a 0 int g=0; g 0 for (int i=1;i<=5;i++)
      {
          a=in.nextInt();
          if (a==0)
          {
           g=i;
          }
         


        } int i=1; int i=1; i 1 i<=5 i 5 i++ i++ i {
          a=in.nextInt();
          if (a==0)
          {
           g=i;
          }
         


        } {
          a=in.nextInt();
          if (a==0)
          {
           g=i;
          }
         


        } a=in.nextInt() a in.nextInt() in.nextInt in if (a==0)
          {
           g=i;
          } a==0 a 0 {
           g=i;
          } g=i g i System.out.print(g) System.out.print System.out System System.out g String[] args args public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = 0;
        int g=0;
      for (int i=1;i<=5;i++)
      {
          a=in.nextInt();
          if (a==0)
          {
           g=i;
          }
         


        }
      System.out.print(g);

    }
} public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = 0;
        int g=0;
      for (int i=1;i<=5;i++)
      {
          a=in.nextInt();
          if (a==0)
          {
           g=i;
          }
         


        }
      System.out.print(g);

    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = 0;
        int g=0;
      for (int i=1;i<=5;i++)
      {
          a=in.nextInt();
          if (a==0)
          {
           g=i;
          }
         


        }
      System.out.print(g);

    }
}