import java.util.*;

class Main {

	static Scanner sc;

	static void solve() {

		int ans = 0;
		for (int i = 0; i < 5; ++i) {
			int tmp = sc.nextInt();
			if (tmp == 0) ans = i + 1;
		}

		System.out.println(ans);
	}
    
    public static void main(String args[]) throws Exception {
        sc = new Scanner(System.in);

		solve();
    }
} import java.util.*; util.* java class Main {

	static Scanner sc;

	static void solve() {

		int ans = 0;
		for (int i = 0; i < 5; ++i) {
			int tmp = sc.nextInt();
			if (tmp == 0) ans = i + 1;
		}

		System.out.println(ans);
	}
    
    public static void main(String args[]) throws Exception {
        sc = new Scanner(System.in);

		solve();
    }
} Main static Scanner sc; sc static void solve() {

		int ans = 0;
		for (int i = 0; i < 5; ++i) {
			int tmp = sc.nextInt();
			if (tmp == 0) ans = i + 1;
		}

		System.out.println(ans);
	} solve {

		int ans = 0;
		for (int i = 0; i < 5; ++i) {
			int tmp = sc.nextInt();
			if (tmp == 0) ans = i + 1;
		}

		System.out.println(ans);
	} int ans = 0; ans 0 for (int i = 0; i < 5; ++i) {
			int tmp = sc.nextInt();
			if (tmp == 0) ans = i + 1;
		} int i = 0; int i = 0; i 0 i < 5 i 5 ++i ++i i {
			int tmp = sc.nextInt();
			if (tmp == 0) ans = i + 1;
		} {
			int tmp = sc.nextInt();
			if (tmp == 0) ans = i + 1;
		} int tmp = sc.nextInt(); tmp sc.nextInt() sc.nextInt sc if (tmp == 0) ans = i + 1; tmp == 0 tmp 0 ans = i + 1 ans i + 1 i 1 System.out.println(ans) System.out.println System.out System System.out ans public static void main(String args[]) throws Exception {
        sc = new Scanner(System.in);

		solve();
    } main {
        sc = new Scanner(System.in);

		solve();
    } sc = new Scanner(System.in) sc new Scanner(System.in) solve() solve String args[] args
import java.util.*;

class Main {

	static Scanner sc;

	static void solve() {

		int ans = 0;
		for (int i = 0; i < 5; ++i) {
			int tmp = sc.nextInt();
			if (tmp == 0) ans = i + 1;
		}

		System.out.println(ans);
	}
    
    public static void main(String args[]) throws Exception {
        sc = new Scanner(System.in);

		solve();
    }
}
