import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
class Main{
	public static void main(String[] args) {
		InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        int a[]=new int[5];
              int ans=0;
              for(int i=0;i<5;i++){
                  a[i]=in.nextInt();
              }
              for(int i=0;i<5;i++){
                  if(a[i]==0){
                      ans=i+1;
                  }
              }
              System.out.println(ans);
          }
      }  import java.util.*; util.* java import java.lang.*; lang.* java import java.math.*; math.* java import java.io.*; io.* java class Main{
	public static void main(String[] args) {
		InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        int a[]=new int[5];
              int ans=0;
              for(int i=0;i<5;i++){
                  a[i]=in.nextInt();
              }
              for(int i=0;i<5;i++){
                  if(a[i]==0){
                      ans=i+1;
                  }
              }
              System.out.println(ans);
          }
      } Main public static void main(String[] args) {
		InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        int a[]=new int[5];
              int ans=0;
              for(int i=0;i<5;i++){
                  a[i]=in.nextInt();
              }
              for(int i=0;i<5;i++){
                  if(a[i]==0){
                      ans=i+1;
                  }
              }
              System.out.println(ans);
          } main {
		InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        int a[]=new int[5];
              int ans=0;
              for(int i=0;i<5;i++){
                  a[i]=in.nextInt();
              }
              for(int i=0;i<5;i++){
                  if(a[i]==0){
                      ans=i+1;
                  }
              }
              System.out.println(ans);
          } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) int a[]=new int[5]; a new int[5] 5 int ans=0; ans 0 for(int i=0;i<5;i++){
                  a[i]=in.nextInt();
              } int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
                  a[i]=in.nextInt();
              } {
                  a[i]=in.nextInt();
              } a[i]=in.nextInt() a[i] a i in.nextInt() in.nextInt in for(int i=0;i<5;i++){
                  if(a[i]==0){
                      ans=i+1;
                  }
              } int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
                  if(a[i]==0){
                      ans=i+1;
                  }
              } {
                  if(a[i]==0){
                      ans=i+1;
                  }
              } if(a[i]==0){
                      ans=i+1;
                  } a[i]==0 a[i] a 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 String[] args args
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
class Main{
	public static void main(String[] args) {
		InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        int a[]=new int[5];
              int ans=0;
              for(int i=0;i<5;i++){
                  a[i]=in.nextInt();
              }
              for(int i=0;i<5;i++){
                  if(a[i]==0){
                      ans=i+1;
                  }
              }
              System.out.println(ans);
          }
      } 