
import java.util.Scanner;

public class Main {
	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();

		if (x1 == 0) {
			System.out.println("1");
		} else if (x2 == 0) {
			System.out.println("2");
		} else if (x3 == 0) {
			System.out.println("3");
		} else if (x4 == 0) {
			System.out.println("4");
		} else if (x5 == 0) {
			System.out.println("5");
		}

		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 x1 = sc.nextInt();
		int x2 = sc.nextInt();
		int x3 = sc.nextInt();
		int x4 = sc.nextInt();
		int x5 = sc.nextInt();

		if (x1 == 0) {
			System.out.println("1");
		} else if (x2 == 0) {
			System.out.println("2");
		} else if (x3 == 0) {
			System.out.println("3");
		} else if (x4 == 0) {
			System.out.println("4");
		} else if (x5 == 0) {
			System.out.println("5");
		}

		sc.close();
	}
} Main 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();

		if (x1 == 0) {
			System.out.println("1");
		} else if (x2 == 0) {
			System.out.println("2");
		} else if (x3 == 0) {
			System.out.println("3");
		} else if (x4 == 0) {
			System.out.println("4");
		} else if (x5 == 0) {
			System.out.println("5");
		}

		sc.close();
	} 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();

		if (x1 == 0) {
			System.out.println("1");
		} else if (x2 == 0) {
			System.out.println("2");
		} else if (x3 == 0) {
			System.out.println("3");
		} else if (x4 == 0) {
			System.out.println("4");
		} else if (x5 == 0) {
			System.out.println("5");
		}

		sc.close();
	} 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 if (x1 == 0) {
			System.out.println("1");
		} else if (x2 == 0) {
			System.out.println("2");
		} else if (x3 == 0) {
			System.out.println("3");
		} else if (x4 == 0) {
			System.out.println("4");
		} else if (x5 == 0) {
			System.out.println("5");
		} x1 == 0 x1 0 {
			System.out.println("1");
		} System.out.println("1") System.out.println System.out System System.out "1" if (x2 == 0) {
			System.out.println("2");
		} else if (x3 == 0) {
			System.out.println("3");
		} else if (x4 == 0) {
			System.out.println("4");
		} else if (x5 == 0) {
			System.out.println("5");
		} x2 == 0 x2 0 {
			System.out.println("2");
		} System.out.println("2") System.out.println System.out System System.out "2" if (x3 == 0) {
			System.out.println("3");
		} else if (x4 == 0) {
			System.out.println("4");
		} else if (x5 == 0) {
			System.out.println("5");
		} x3 == 0 x3 0 {
			System.out.println("3");
		} System.out.println("3") System.out.println System.out System System.out "3" if (x4 == 0) {
			System.out.println("4");
		} else if (x5 == 0) {
			System.out.println("5");
		} x4 == 0 x4 0 {
			System.out.println("4");
		} System.out.println("4") System.out.println System.out System System.out "4" if (x5 == 0) {
			System.out.println("5");
		} x5 == 0 x5 0 {
			System.out.println("5");
		} System.out.println("5") System.out.println System.out System System.out "5" sc.close() sc.close sc String[] args args public class Main {
	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();

		if (x1 == 0) {
			System.out.println("1");
		} else if (x2 == 0) {
			System.out.println("2");
		} else if (x3 == 0) {
			System.out.println("3");
		} else if (x4 == 0) {
			System.out.println("4");
		} else if (x5 == 0) {
			System.out.println("5");
		}

		sc.close();
	}
} public class Main {
	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();

		if (x1 == 0) {
			System.out.println("1");
		} else if (x2 == 0) {
			System.out.println("2");
		} else if (x3 == 0) {
			System.out.println("3");
		} else if (x4 == 0) {
			System.out.println("4");
		} else if (x5 == 0) {
			System.out.println("5");
		}

		sc.close();
	}
} Main

import java.util.Scanner;

public class Main {
	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();

		if (x1 == 0) {
			System.out.println("1");
		} else if (x2 == 0) {
			System.out.println("2");
		} else if (x3 == 0) {
			System.out.println("3");
		} else if (x4 == 0) {
			System.out.println("4");
		} else if (x5 == 0) {
			System.out.println("5");
		}

		sc.close();
	}
}
