import static java.lang.Math.max;
import static java.util.Arrays.deepToString;

import java.io.*;
import java.util.*;

public class stacks_nn {

	static void solve() throws Exception {
		int n = nextInt();
		Queue<Integer> q = new PriorityQueue<Integer>();
		int ans = 1;
		for (int i = 0; i < n; i++) {
			int x = nextInt();
			if (x > 0 || q.isEmpty()) {
				q.add(1);
			} else {
				int add = q.poll() + 1;
				ans = max(ans, add);
				q.add(add);
			}
		}
		out.println(ans);
	}

	static BufferedReader br;
	static StringTokenizer st;
	static PrintWriter out;

	static void debug(Object... a) {
		System.err.println(deepToString(a));
	}

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

	static String next() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String line = br.readLine();
			if (line == null) {
				return null;
			}
			st = new StringTokenizer(line);
		}
		return st.nextToken();
	}

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

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

	public static void main(String[] args) {
		try {
			File file = new File("stacks.in");
			InputStream input = System.in;
			OutputStream output = System.out;
			if (file.canRead()) {
				input = (new FileInputStream(file));
				output = (new PrintStream("stacks.out"));
			}
			br = new BufferedReader(new InputStreamReader(input));
			out = new PrintWriter(output);
			solve();
			out.close();
			br.close();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}
