import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();
    if (a == 0) 
      System.out.println("1");
    if (b == 0) 
      System.out.println("2");
    if (c == 0) 
      System.out.println("3");
    if (d == 0) 
      System.out.println("4");
    if (e == 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 a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();
    if (a == 0) 
      System.out.println("1");
    if (b == 0) 
      System.out.println("2");
    if (c == 0) 
      System.out.println("3");
    if (d == 0) 
      System.out.println("4");
    if (e == 0) 
      System.out.println("5");
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();
    if (a == 0) 
      System.out.println("1");
    if (b == 0) 
      System.out.println("2");
    if (c == 0) 
      System.out.println("3");
    if (d == 0) 
      System.out.println("4");
    if (e == 0) 
      System.out.println("5");
  } main {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();
    if (a == 0) 
      System.out.println("1");
    if (b == 0) 
      System.out.println("2");
    if (c == 0) 
      System.out.println("3");
    if (d == 0) 
      System.out.println("4");
    if (e == 0) 
      System.out.println("5");
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int c = sc.nextInt(); c sc.nextInt() sc.nextInt sc int d = sc.nextInt(); d sc.nextInt() sc.nextInt sc int e = sc.nextInt(); e sc.nextInt() sc.nextInt sc if (a == 0) 
      System.out.println("1"); a == 0 a 0 System.out.println("1") System.out.println System.out System System.out "1" if (b == 0) 
      System.out.println("2"); b == 0 b 0 System.out.println("2") System.out.println System.out System System.out "2" if (c == 0) 
      System.out.println("3"); c == 0 c 0 System.out.println("3") System.out.println System.out System System.out "3" if (d == 0) 
      System.out.println("4"); d == 0 d 0 System.out.println("4") System.out.println System.out System System.out "4" if (e == 0) 
      System.out.println("5"); e == 0 e 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 a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();
    if (a == 0) 
      System.out.println("1");
    if (b == 0) 
      System.out.println("2");
    if (c == 0) 
      System.out.println("3");
    if (d == 0) 
      System.out.println("4");
    if (e == 0) 
      System.out.println("5");
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();
    if (a == 0) 
      System.out.println("1");
    if (b == 0) 
      System.out.println("2");
    if (c == 0) 
      System.out.println("3");
    if (d == 0) 
      System.out.println("4");
    if (e == 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 a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int e = sc.nextInt();
    if (a == 0) 
      System.out.println("1");
    if (b == 0) 
      System.out.println("2");
    if (c == 0) 
      System.out.println("3");
    if (d == 0) 
      System.out.println("4");
    if (e == 0) 
      System.out.println("5");
  }
}