import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int idx = 1;
      while(idx <= 5) {
      	int num = sc.nextInt();
      	if(num == 0) {
      		System.out.println(idx);
      		return;
      	}
      	idx++;
      }
      sc.close();
  }
} import java.util.*; util.* java public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int idx = 1;
      while(idx <= 5) {
      	int num = sc.nextInt();
      	if(num == 0) {
      		System.out.println(idx);
      		return;
      	}
      	idx++;
      }
      sc.close();
  }
} Main public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int idx = 1;
      while(idx <= 5) {
      	int num = sc.nextInt();
      	if(num == 0) {
      		System.out.println(idx);
      		return;
      	}
      	idx++;
      }
      sc.close();
  } main { 
      Scanner sc = new Scanner(System.in);
      int idx = 1;
      while(idx <= 5) {
      	int num = sc.nextInt();
      	if(num == 0) {
      		System.out.println(idx);
      		return;
      	}
      	idx++;
      }
      sc.close();
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int idx = 1; idx 1 while(idx <= 5) {
      	int num = sc.nextInt();
      	if(num == 0) {
      		System.out.println(idx);
      		return;
      	}
      	idx++;
      } idx <= 5 idx 5 {
      	int num = sc.nextInt();
      	if(num == 0) {
      		System.out.println(idx);
      		return;
      	}
      	idx++;
      } int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc if(num == 0) {
      		System.out.println(idx);
      		return;
      	} num == 0 num 0 {
      		System.out.println(idx);
      		return;
      	} System.out.println(idx) System.out.println System.out System System.out idx return; idx++ idx sc.close() sc.close sc String[] args args public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int idx = 1;
      while(idx <= 5) {
      	int num = sc.nextInt();
      	if(num == 0) {
      		System.out.println(idx);
      		return;
      	}
      	idx++;
      }
      sc.close();
  }
} public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int idx = 1;
      while(idx <= 5) {
      	int num = sc.nextInt();
      	if(num == 0) {
      		System.out.println(idx);
      		return;
      	}
      	idx++;
      }
      sc.close();
  }
} Main
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int idx = 1;
      while(idx <= 5) {
      	int num = sc.nextInt();
      	if(num == 0) {
      		System.out.println(idx);
      		return;
      	}
      	idx++;
      }
      sc.close();
  }
}