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