import java.util.Scanner;

public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int x1 = sc.nextInt();
        int x2 = sc.nextInt();
        int x3 = sc.nextInt();
        int x4 = sc.nextInt();
        int x5 = sc.nextInt();

        System.out.println(solve(x1, x2, x3, x4, x5));
    }

    private static int solve(int x1, int x2, int x3, int x4, int x5) {
        if (x1 == 0) return 1;
        if (x2 == 0) return 2;
        if (x3 == 0) return 3;
        if (x4 == 0) return 4;

        return 5;
    }
} import java.util.Scanner; Scanner java.util public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int x1 = sc.nextInt();
        int x2 = sc.nextInt();
        int x3 = sc.nextInt();
        int x4 = sc.nextInt();
        int x5 = sc.nextInt();

        System.out.println(solve(x1, x2, x3, x4, x5));
    }

    private static int solve(int x1, int x2, int x3, int x4, int x5) {
        if (x1 == 0) return 1;
        if (x2 == 0) return 2;
        if (x3 == 0) return 3;
        if (x4 == 0) return 4;

        return 5;
    }
} Main private static final int MOD = 1_000_000_007; MOD 1_000_000_007 private static final String YES = "Yes"; YES "Yes" private static final String NO = "No"; NO "No" public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int x1 = sc.nextInt();
        int x2 = sc.nextInt();
        int x3 = sc.nextInt();
        int x4 = sc.nextInt();
        int x5 = sc.nextInt();

        System.out.println(solve(x1, x2, x3, x4, x5));
    } main {
        Scanner sc = new Scanner(System.in);

        int x1 = sc.nextInt();
        int x2 = sc.nextInt();
        int x3 = sc.nextInt();
        int x4 = sc.nextInt();
        int x5 = sc.nextInt();

        System.out.println(solve(x1, x2, x3, x4, x5));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x1 = sc.nextInt(); x1 sc.nextInt() sc.nextInt sc int x2 = sc.nextInt(); x2 sc.nextInt() sc.nextInt sc int x3 = sc.nextInt(); x3 sc.nextInt() sc.nextInt sc int x4 = sc.nextInt(); x4 sc.nextInt() sc.nextInt sc int x5 = sc.nextInt(); x5 sc.nextInt() sc.nextInt sc System.out.println(solve(x1, x2, x3, x4, x5)) System.out.println System.out System System.out solve(x1, x2, x3, x4, x5) solve x1 x2 x3 x4 x5 String[] args args private static int solve(int x1, int x2, int x3, int x4, int x5) {
        if (x1 == 0) return 1;
        if (x2 == 0) return 2;
        if (x3 == 0) return 3;
        if (x4 == 0) return 4;

        return 5;
    } solve {
        if (x1 == 0) return 1;
        if (x2 == 0) return 2;
        if (x3 == 0) return 3;
        if (x4 == 0) return 4;

        return 5;
    } if (x1 == 0) return 1; x1 == 0 x1 0 return 1; 1 if (x2 == 0) return 2; x2 == 0 x2 0 return 2; 2 if (x3 == 0) return 3; x3 == 0 x3 0 return 3; 3 if (x4 == 0) return 4; x4 == 0 x4 0 return 4; 4 return 5; 5 int x1 x1 int x2 x2 int x3 x3 int x4 x4 int x5 x5 public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int x1 = sc.nextInt();
        int x2 = sc.nextInt();
        int x3 = sc.nextInt();
        int x4 = sc.nextInt();
        int x5 = sc.nextInt();

        System.out.println(solve(x1, x2, x3, x4, x5));
    }

    private static int solve(int x1, int x2, int x3, int x4, int x5) {
        if (x1 == 0) return 1;
        if (x2 == 0) return 2;
        if (x3 == 0) return 3;
        if (x4 == 0) return 4;

        return 5;
    }
} public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int x1 = sc.nextInt();
        int x2 = sc.nextInt();
        int x3 = sc.nextInt();
        int x4 = sc.nextInt();
        int x5 = sc.nextInt();

        System.out.println(solve(x1, x2, x3, x4, x5));
    }

    private static int solve(int x1, int x2, int x3, int x4, int x5) {
        if (x1 == 0) return 1;
        if (x2 == 0) return 2;
        if (x3 == 0) return 3;
        if (x4 == 0) return 4;

        return 5;
    }
} Main
import java.util.Scanner;

public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int x1 = sc.nextInt();
        int x2 = sc.nextInt();
        int x3 = sc.nextInt();
        int x4 = sc.nextInt();
        int x5 = sc.nextInt();

        System.out.println(solve(x1, x2, x3, x4, x5));
    }

    private static int solve(int x1, int x2, int x3, int x4, int x5) {
        if (x1 == 0) return 1;
        if (x2 == 0) return 2;
        if (x3 == 0) return 3;
        if (x4 == 0) return 4;

        return 5;
    }
}