import java.util.Scanner;
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();
    int ans = 0;
    if(a == 0) ans = 1;
    else if(b == 0) ans = 2;
    else if(c == 0) ans = 3;
    else if(d == 0) ans = 4;
    else ans = 5;
    System.out.println(ans);
    sc.close();
  }
} import java.util.Scanner; Scanner 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();
    int ans = 0;
    if(a == 0) ans = 1;
    else if(b == 0) ans = 2;
    else if(c == 0) ans = 3;
    else if(d == 0) ans = 4;
    else ans = 5;
    System.out.println(ans);
    sc.close();
  }
} 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();
    int ans = 0;
    if(a == 0) ans = 1;
    else if(b == 0) ans = 2;
    else if(c == 0) ans = 3;
    else if(d == 0) ans = 4;
    else ans = 5;
    System.out.println(ans);
    sc.close();
  } 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();
    int ans = 0;
    if(a == 0) ans = 1;
    else if(b == 0) ans = 2;
    else if(c == 0) ans = 3;
    else if(d == 0) ans = 4;
    else ans = 5;
    System.out.println(ans);
    sc.close();
  } 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 int ans = 0; ans 0 if(a == 0) ans = 1;
    else if(b == 0) ans = 2;
    else if(c == 0) ans = 3;
    else if(d == 0) ans = 4;
    else ans = 5; a == 0 a 0 ans = 1 ans 1 if(b == 0) ans = 2;
    else if(c == 0) ans = 3;
    else if(d == 0) ans = 4;
    else ans = 5; b == 0 b 0 ans = 2 ans 2 if(c == 0) ans = 3;
    else if(d == 0) ans = 4;
    else ans = 5; c == 0 c 0 ans = 3 ans 3 if(d == 0) ans = 4;
    else ans = 5; d == 0 d 0 ans = 4 ans 4 ans = 5 ans 5 System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc 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();
    int ans = 0;
    if(a == 0) ans = 1;
    else if(b == 0) ans = 2;
    else if(c == 0) ans = 3;
    else if(d == 0) ans = 4;
    else ans = 5;
    System.out.println(ans);
    sc.close();
  }
} 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();
    int ans = 0;
    if(a == 0) ans = 1;
    else if(b == 0) ans = 2;
    else if(c == 0) ans = 3;
    else if(d == 0) ans = 4;
    else ans = 5;
    System.out.println(ans);
    sc.close();
  }
} Main
import java.util.Scanner;
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();
    int ans = 0;
    if(a == 0) ans = 1;
    else if(b == 0) ans = 2;
    else if(c == 0) ans = 3;
    else if(d == 0) ans = 4;
    else ans = 5;
    System.out.println(ans);
    sc.close();
  }
}
