import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        System.out.println(run());
    }

    private static ArrayList<Integer> nScan(Scanner sc, int n) {
        ArrayList<Integer> al = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            al.add(sc.nextInt());
        }
        return al;
    }

    private static Object run() {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> x = nScan(sc,5);
        sc.close();

        for (int i = 0; i < 5; i++) {
            if (x.get(i) == 0) return i + 1;
        }
        return 0;
    }
} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        System.out.println(run());
    }

    private static ArrayList<Integer> nScan(Scanner sc, int n) {
        ArrayList<Integer> al = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            al.add(sc.nextInt());
        }
        return al;
    }

    private static Object run() {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> x = nScan(sc,5);
        sc.close();

        for (int i = 0; i < 5; i++) {
            if (x.get(i) == 0) return i + 1;
        }
        return 0;
    }
} Main public static void main(String[] args) {
        System.out.println(run());
    } main {
        System.out.println(run());
    } System.out.println(run()) System.out.println System.out System System.out run() run String[] args args private static ArrayList<Integer> nScan(Scanner sc, int n) {
        ArrayList<Integer> al = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            al.add(sc.nextInt());
        }
        return al;
    } nScan {
        ArrayList<Integer> al = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            al.add(sc.nextInt());
        }
        return al;
    } ArrayList<Integer> al = new ArrayList<>(); al new ArrayList<>() for (int i = 0; i < n; i++) {
            al.add(sc.nextInt());
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            al.add(sc.nextInt());
        } {
            al.add(sc.nextInt());
        } al.add(sc.nextInt()) al.add al sc.nextInt() sc.nextInt sc return al; al Scanner sc sc int n n private static Object run() {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> x = nScan(sc,5);
        sc.close();

        for (int i = 0; i < 5; i++) {
            if (x.get(i) == 0) return i + 1;
        }
        return 0;
    } run {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> x = nScan(sc,5);
        sc.close();

        for (int i = 0; i < 5; i++) {
            if (x.get(i) == 0) return i + 1;
        }
        return 0;
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) ArrayList<Integer> x = nScan(sc,5); x nScan(sc,5) nScan sc 5 sc.close() sc.close sc for (int i = 0; i < 5; i++) {
            if (x.get(i) == 0) return i + 1;
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
            if (x.get(i) == 0) return i + 1;
        } {
            if (x.get(i) == 0) return i + 1;
        } if (x.get(i) == 0) return i + 1; x.get(i) == 0 x.get(i) x.get x i 0 return i + 1; i + 1 i 1 return 0; 0 public class Main {
    public static void main(String[] args) {
        System.out.println(run());
    }

    private static ArrayList<Integer> nScan(Scanner sc, int n) {
        ArrayList<Integer> al = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            al.add(sc.nextInt());
        }
        return al;
    }

    private static Object run() {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> x = nScan(sc,5);
        sc.close();

        for (int i = 0; i < 5; i++) {
            if (x.get(i) == 0) return i + 1;
        }
        return 0;
    }
} public class Main {
    public static void main(String[] args) {
        System.out.println(run());
    }

    private static ArrayList<Integer> nScan(Scanner sc, int n) {
        ArrayList<Integer> al = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            al.add(sc.nextInt());
        }
        return al;
    }

    private static Object run() {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> x = nScan(sc,5);
        sc.close();

        for (int i = 0; i < 5; i++) {
            if (x.get(i) == 0) return i + 1;
        }
        return 0;
    }
} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        System.out.println(run());
    }

    private static ArrayList<Integer> nScan(Scanner sc, int n) {
        ArrayList<Integer> al = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            al.add(sc.nextInt());
        }
        return al;
    }

    private static Object run() {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> x = nScan(sc,5);
        sc.close();

        for (int i = 0; i < 5; i++) {
            if (x.get(i) == 0) return i + 1;
        }
        return 0;
    }
}