import java.lang.reflect.Array;
import java.util.*;
import java.io.*;
import java.lang.*;

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");
        else if (b == 0)
            System.out.println("2");
        else if (c == 0)
            System.out.println("3");
        else if (d == 0)
            System.out.println("4");
        else if (e == 0)
            System.out.println("5");


    }
} import java.lang.reflect.Array; Array java.lang.reflect import java.util.*; util.* java import java.io.*; io.* java import java.lang.*; lang.* 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");
        else if (b == 0)
            System.out.println("2");
        else if (c == 0)
            System.out.println("3");
        else if (d == 0)
            System.out.println("4");
        else 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");
        else if (b == 0)
            System.out.println("2");
        else if (c == 0)
            System.out.println("3");
        else if (d == 0)
            System.out.println("4");
        else 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");
        else if (b == 0)
            System.out.println("2");
        else if (c == 0)
            System.out.println("3");
        else if (d == 0)
            System.out.println("4");
        else 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");
        else if (b == 0)
            System.out.println("2");
        else if (c == 0)
            System.out.println("3");
        else if (d == 0)
            System.out.println("4");
        else if (e == 0)
            System.out.println("5"); a == 0 a 0 System.out.println("1") System.out.println System.out System System.out "1" if (b == 0)
            System.out.println("2");
        else if (c == 0)
            System.out.println("3");
        else if (d == 0)
            System.out.println("4");
        else if (e == 0)
            System.out.println("5"); b == 0 b 0 System.out.println("2") System.out.println System.out System System.out "2" if (c == 0)
            System.out.println("3");
        else if (d == 0)
            System.out.println("4");
        else if (e == 0)
            System.out.println("5"); c == 0 c 0 System.out.println("3") System.out.println System.out System System.out "3" if (d == 0)
            System.out.println("4");
        else if (e == 0)
            System.out.println("5"); 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");
        else if (b == 0)
            System.out.println("2");
        else if (c == 0)
            System.out.println("3");
        else if (d == 0)
            System.out.println("4");
        else 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");
        else if (b == 0)
            System.out.println("2");
        else if (c == 0)
            System.out.println("3");
        else if (d == 0)
            System.out.println("4");
        else if (e == 0)
            System.out.println("5");


    }
} Main
import java.lang.reflect.Array;
import java.util.*;
import java.io.*;
import java.lang.*;

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");
        else if (b == 0)
            System.out.println("2");
        else if (c == 0)
            System.out.println("3");
        else if (d == 0)
            System.out.println("4");
        else if (e == 0)
            System.out.println("5");


    }
}
