//package abc170_A;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastScanner in = new FastScanner(System.in);
		int n = 5;
		for(int i = 1; i <= n; i++)
		{
			int num = in.nextInt();
			if(num == 0) {
				System.out.println(i);
				break;
			}
		}
	}

}
///////////////////////////////////TEMPLATE///////////////////////////////////
class FastScanner {
	BufferedReader br;
	StringTokenizer st;

	FastScanner(InputStream stream) {
		try {
			br = new BufferedReader(new InputStreamReader(stream));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	FastScanner(File input) {
		try {
			br = new BufferedReader(new FileReader(input));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	String nextLine() {
		String s = "";
		try {
			s = br.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return s;
	}

	String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(next());
	}

	long nextLong() {
		return Long.parseLong(next());
	}

	double nextDouble() {
		return Double.parseDouble(next());
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.File; File java.io import java.io.FileReader; FileReader java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastScanner in = new FastScanner(System.in);
		int n = 5;
		for(int i = 1; i <= n; i++)
		{
			int num = in.nextInt();
			if(num == 0) {
				System.out.println(i);
				break;
			}
		}
	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastScanner in = new FastScanner(System.in);
		int n = 5;
		for(int i = 1; i <= n; i++)
		{
			int num = in.nextInt();
			if(num == 0) {
				System.out.println(i);
				break;
			}
		}
	} main {
		// TODO Auto-generated method stub
		FastScanner in = new FastScanner(System.in);
		int n = 5;
		for(int i = 1; i <= n; i++)
		{
			int num = in.nextInt();
			if(num == 0) {
				System.out.println(i);
				break;
			}
		}
	} FastScanner in = new FastScanner(System.in); in new FastScanner(System.in) int n = 5; n 5 for(int i = 1; i <= n; i++)
		{
			int num = in.nextInt();
			if(num == 0) {
				System.out.println(i);
				break;
			}
		} int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
			int num = in.nextInt();
			if(num == 0) {
				System.out.println(i);
				break;
			}
		} {
			int num = in.nextInt();
			if(num == 0) {
				System.out.println(i);
				break;
			}
		} int num = in.nextInt(); num in.nextInt() in.nextInt in if(num == 0) {
				System.out.println(i);
				break;
			} num == 0 num 0 {
				System.out.println(i);
				break;
			} System.out.println(i) System.out.println System.out System System.out i break; String[] args args class FastScanner {
	BufferedReader br;
	StringTokenizer st;

	FastScanner(InputStream stream) {
		try {
			br = new BufferedReader(new InputStreamReader(stream));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	FastScanner(File input) {
		try {
			br = new BufferedReader(new FileReader(input));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	String nextLine() {
		String s = "";
		try {
			s = br.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return s;
	}

	String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(next());
	}

	long nextLong() {
		return Long.parseLong(next());
	}

	double nextDouble() {
		return Double.parseDouble(next());
	}
} FastScanner BufferedReader br; br StringTokenizer st; st FastScanner(InputStream stream) {
		try {
			br = new BufferedReader(new InputStreamReader(stream));
		} catch (Exception e) {
			e.printStackTrace();
		}
	} FastScanner {
		try {
			br = new BufferedReader(new InputStreamReader(stream));
		} catch (Exception e) {
			e.printStackTrace();
		}
	} try {
			br = new BufferedReader(new InputStreamReader(stream));
		} catch (Exception e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		} Exception e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			br = new BufferedReader(new InputStreamReader(stream));
		} br = new BufferedReader(new InputStreamReader(stream)) br new BufferedReader(new InputStreamReader(stream)) InputStream stream stream FastScanner(File input) {
		try {
			br = new BufferedReader(new FileReader(input));
		} catch (Exception e) {
			e.printStackTrace();
		}
	} FastScanner {
		try {
			br = new BufferedReader(new FileReader(input));
		} catch (Exception e) {
			e.printStackTrace();
		}
	} try {
			br = new BufferedReader(new FileReader(input));
		} catch (Exception e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		} Exception e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			br = new BufferedReader(new FileReader(input));
		} br = new BufferedReader(new FileReader(input)) br new BufferedReader(new FileReader(input)) File input input String nextLine() {
		String s = "";
		try {
			s = br.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return s;
	} nextLine {
		String s = "";
		try {
			s = br.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return s;
	} String s = ""; s "" try {
			s = br.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} IOException e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			s = br.readLine();
		} s = br.readLine() s br.readLine() br.readLine br return s; s String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	} next {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	} while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		} st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		} try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			} catch (IOException e) {
				e.printStackTrace();
			} IOException e {
				e.printStackTrace();
			} e.printStackTrace() e.printStackTrace e {
				st = new StringTokenizer(br.readLine());
			} st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st int nextInt() {
		return Integer.parseInt(next());
	} nextInt {
		return Integer.parseInt(next());
	} return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next long nextLong() {
		return Long.parseLong(next());
	} nextLong {
		return Long.parseLong(next());
	} return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next double nextDouble() {
		return Double.parseDouble(next());
	} nextDouble {
		return Double.parseDouble(next());
	} return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastScanner in = new FastScanner(System.in);
		int n = 5;
		for(int i = 1; i <= n; i++)
		{
			int num = in.nextInt();
			if(num == 0) {
				System.out.println(i);
				break;
			}
		}
	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastScanner in = new FastScanner(System.in);
		int n = 5;
		for(int i = 1; i <= n; i++)
		{
			int num = in.nextInt();
			if(num == 0) {
				System.out.println(i);
				break;
			}
		}
	}

} Main
//package abc170_A;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastScanner in = new FastScanner(System.in);
		int n = 5;
		for(int i = 1; i <= n; i++)
		{
			int num = in.nextInt();
			if(num == 0) {
				System.out.println(i);
				break;
			}
		}
	}

}
///////////////////////////////////TEMPLATE///////////////////////////////////
class FastScanner {
	BufferedReader br;
	StringTokenizer st;

	FastScanner(InputStream stream) {
		try {
			br = new BufferedReader(new InputStreamReader(stream));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	FastScanner(File input) {
		try {
			br = new BufferedReader(new FileReader(input));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	String nextLine() {
		String s = "";
		try {
			s = br.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return s;
	}

	String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(next());
	}

	long nextLong() {
		return Long.parseLong(next());
	}

	double nextDouble() {
		return Double.parseDouble(next());
	}
}
