import java.util.Scanner;

class Main {

  public static void main(String[] args) {
    new Main().run();
  }

  private static Scanner sc;

  private void run() {
    sc = new Scanner(System.in);
    for (int i = 0; i < 5; i++) {
      int num = Integer.parseInt(sc.next());
      if (num == 0) {
        System.out.println(i + 1);
        break;
      }
    }
  }
} import java.util.Scanner; Scanner java.util class Main {

  public static void main(String[] args) {
    new Main().run();
  }

  private static Scanner sc;

  private void run() {
    sc = new Scanner(System.in);
    for (int i = 0; i < 5; i++) {
      int num = Integer.parseInt(sc.next());
      if (num == 0) {
        System.out.println(i + 1);
        break;
      }
    }
  }
} Main private static Scanner sc; sc public static void main(String[] args) {
    new Main().run();
  } main {
    new Main().run();
  } new Main().run() new Main().run new Main() String[] args args private void run() {
    sc = new Scanner(System.in);
    for (int i = 0; i < 5; i++) {
      int num = Integer.parseInt(sc.next());
      if (num == 0) {
        System.out.println(i + 1);
        break;
      }
    }
  } run {
    sc = new Scanner(System.in);
    for (int i = 0; i < 5; i++) {
      int num = Integer.parseInt(sc.next());
      if (num == 0) {
        System.out.println(i + 1);
        break;
      }
    }
  } sc = new Scanner(System.in) sc new Scanner(System.in) for (int i = 0; i < 5; i++) {
      int num = Integer.parseInt(sc.next());
      if (num == 0) {
        System.out.println(i + 1);
        break;
      }
    } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
      int num = Integer.parseInt(sc.next());
      if (num == 0) {
        System.out.println(i + 1);
        break;
      }
    } {
      int num = Integer.parseInt(sc.next());
      if (num == 0) {
        System.out.println(i + 1);
        break;
      }
    } int num = Integer.parseInt(sc.next()); num Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc if (num == 0) {
        System.out.println(i + 1);
        break;
      } num == 0 num 0 {
        System.out.println(i + 1);
        break;
      } System.out.println(i + 1) System.out.println System.out System System.out i + 1 i 1 break;
import java.util.Scanner;

class Main {

  public static void main(String[] args) {
    new Main().run();
  }

  private static Scanner sc;

  private void run() {
    sc = new Scanner(System.in);
    for (int i = 0; i < 5; i++) {
      int num = Integer.parseInt(sc.next());
      if (num == 0) {
        System.out.println(i + 1);
        break;
      }
    }
  }
}
