import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x1 = sc.nextInt();
    int x2 = sc.nextInt();
    int x3 = sc.nextInt();
    int x4 = sc.nextInt();
    int x5 = sc.nextInt();
    
    if(x1==0)System.out.println(1);
    if(x2==0)System.out.println(2);
    if(x3==0)System.out.println(3);
    if(x4==0)System.out.println(4);
    if(x5==0)System.out.println(5);
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x1 = sc.nextInt();
    int x2 = sc.nextInt();
    int x3 = sc.nextInt();
    int x4 = sc.nextInt();
    int x5 = sc.nextInt();
    
    if(x1==0)System.out.println(1);
    if(x2==0)System.out.println(2);
    if(x3==0)System.out.println(3);
    if(x4==0)System.out.println(4);
    if(x5==0)System.out.println(5);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x1 = sc.nextInt();
    int x2 = sc.nextInt();
    int x3 = sc.nextInt();
    int x4 = sc.nextInt();
    int x5 = sc.nextInt();
    
    if(x1==0)System.out.println(1);
    if(x2==0)System.out.println(2);
    if(x3==0)System.out.println(3);
    if(x4==0)System.out.println(4);
    if(x5==0)System.out.println(5);
  } main {
    Scanner sc = new Scanner(System.in);
    int x1 = sc.nextInt();
    int x2 = sc.nextInt();
    int x3 = sc.nextInt();
    int x4 = sc.nextInt();
    int x5 = sc.nextInt();
    
    if(x1==0)System.out.println(1);
    if(x2==0)System.out.println(2);
    if(x3==0)System.out.println(3);
    if(x4==0)System.out.println(4);
    if(x5==0)System.out.println(5);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x1 = sc.nextInt(); x1 sc.nextInt() sc.nextInt sc int x2 = sc.nextInt(); x2 sc.nextInt() sc.nextInt sc int x3 = sc.nextInt(); x3 sc.nextInt() sc.nextInt sc int x4 = sc.nextInt(); x4 sc.nextInt() sc.nextInt sc int x5 = sc.nextInt(); x5 sc.nextInt() sc.nextInt sc if(x1==0)System.out.println(1); x1==0 x1 0 System.out.println(1) System.out.println System.out System System.out 1 if(x2==0)System.out.println(2); x2==0 x2 0 System.out.println(2) System.out.println System.out System System.out 2 if(x3==0)System.out.println(3); x3==0 x3 0 System.out.println(3) System.out.println System.out System System.out 3 if(x4==0)System.out.println(4); x4==0 x4 0 System.out.println(4) System.out.println System.out System System.out 4 if(x5==0)System.out.println(5); x5==0 x5 0 System.out.println(5) System.out.println System.out System System.out 5 String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x1 = sc.nextInt();
    int x2 = sc.nextInt();
    int x3 = sc.nextInt();
    int x4 = sc.nextInt();
    int x5 = sc.nextInt();
    
    if(x1==0)System.out.println(1);
    if(x2==0)System.out.println(2);
    if(x3==0)System.out.println(3);
    if(x4==0)System.out.println(4);
    if(x5==0)System.out.println(5);
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x1 = sc.nextInt();
    int x2 = sc.nextInt();
    int x3 = sc.nextInt();
    int x4 = sc.nextInt();
    int x5 = sc.nextInt();
    
    if(x1==0)System.out.println(1);
    if(x2==0)System.out.println(2);
    if(x3==0)System.out.println(3);
    if(x4==0)System.out.println(4);
    if(x5==0)System.out.println(5);
  }
} Main
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x1 = sc.nextInt();
    int x2 = sc.nextInt();
    int x3 = sc.nextInt();
    int x4 = sc.nextInt();
    int x5 = sc.nextInt();
    
    if(x1==0)System.out.println(1);
    if(x2==0)System.out.println(2);
    if(x3==0)System.out.println(3);
    if(x4==0)System.out.println(4);
    if(x5==0)System.out.println(5);
  }
}