
import java.util.*;
 
class Main {
    public static void main(String[] args) {
 	   Scanner sc = new Scanner(System.in);
		int intA = sc.nextInt();
      	int intB = sc.nextInt();
      	int intC = sc.nextInt();
      	int intD = sc.nextInt();
      	int intE = sc.nextInt();
      

      if (intA == 0 ) {
        System.out.println("1");
      } else if (intB == 0){
        System.out.println("2");
      } else if (intC == 0){
        System.out.println("3");
      } else if (intD == 0){
        System.out.println("4");
      } else if (intE == 0){
        System.out.println("5");
      }
    }
} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
 	   Scanner sc = new Scanner(System.in);
		int intA = sc.nextInt();
      	int intB = sc.nextInt();
      	int intC = sc.nextInt();
      	int intD = sc.nextInt();
      	int intE = sc.nextInt();
      

      if (intA == 0 ) {
        System.out.println("1");
      } else if (intB == 0){
        System.out.println("2");
      } else if (intC == 0){
        System.out.println("3");
      } else if (intD == 0){
        System.out.println("4");
      } else if (intE == 0){
        System.out.println("5");
      }
    }
} Main public static void main(String[] args) {
 	   Scanner sc = new Scanner(System.in);
		int intA = sc.nextInt();
      	int intB = sc.nextInt();
      	int intC = sc.nextInt();
      	int intD = sc.nextInt();
      	int intE = sc.nextInt();
      

      if (intA == 0 ) {
        System.out.println("1");
      } else if (intB == 0){
        System.out.println("2");
      } else if (intC == 0){
        System.out.println("3");
      } else if (intD == 0){
        System.out.println("4");
      } else if (intE == 0){
        System.out.println("5");
      }
    } main {
 	   Scanner sc = new Scanner(System.in);
		int intA = sc.nextInt();
      	int intB = sc.nextInt();
      	int intC = sc.nextInt();
      	int intD = sc.nextInt();
      	int intE = sc.nextInt();
      

      if (intA == 0 ) {
        System.out.println("1");
      } else if (intB == 0){
        System.out.println("2");
      } else if (intC == 0){
        System.out.println("3");
      } else if (intD == 0){
        System.out.println("4");
      } else if (intE == 0){
        System.out.println("5");
      }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int intA = sc.nextInt(); intA sc.nextInt() sc.nextInt sc int intB = sc.nextInt(); intB sc.nextInt() sc.nextInt sc int intC = sc.nextInt(); intC sc.nextInt() sc.nextInt sc int intD = sc.nextInt(); intD sc.nextInt() sc.nextInt sc int intE = sc.nextInt(); intE sc.nextInt() sc.nextInt sc if (intA == 0 ) {
        System.out.println("1");
      } else if (intB == 0){
        System.out.println("2");
      } else if (intC == 0){
        System.out.println("3");
      } else if (intD == 0){
        System.out.println("4");
      } else if (intE == 0){
        System.out.println("5");
      } intA == 0 intA 0 {
        System.out.println("1");
      } System.out.println("1") System.out.println System.out System System.out "1" if (intB == 0){
        System.out.println("2");
      } else if (intC == 0){
        System.out.println("3");
      } else if (intD == 0){
        System.out.println("4");
      } else if (intE == 0){
        System.out.println("5");
      } intB == 0 intB 0 {
        System.out.println("2");
      } System.out.println("2") System.out.println System.out System System.out "2" if (intC == 0){
        System.out.println("3");
      } else if (intD == 0){
        System.out.println("4");
      } else if (intE == 0){
        System.out.println("5");
      } intC == 0 intC 0 {
        System.out.println("3");
      } System.out.println("3") System.out.println System.out System System.out "3" if (intD == 0){
        System.out.println("4");
      } else if (intE == 0){
        System.out.println("5");
      } intD == 0 intD 0 {
        System.out.println("4");
      } System.out.println("4") System.out.println System.out System System.out "4" if (intE == 0){
        System.out.println("5");
      } intE == 0 intE 0 {
        System.out.println("5");
      } System.out.println("5") System.out.println System.out System System.out "5" String[] args args

import java.util.*;
 
class Main {
    public static void main(String[] args) {
 	   Scanner sc = new Scanner(System.in);
		int intA = sc.nextInt();
      	int intB = sc.nextInt();
      	int intC = sc.nextInt();
      	int intD = sc.nextInt();
      	int intE = sc.nextInt();
      

      if (intA == 0 ) {
        System.out.println("1");
      } else if (intB == 0){
        System.out.println("2");
      } else if (intC == 0){
        System.out.println("3");
      } else if (intD == 0){
        System.out.println("4");
      } else if (intE == 0){
        System.out.println("5");
      }
    }
}
