// Arup Guha
// 5/26/2016
// Solution to 2018 March USACO Silver Problem: Out of Sorts

import java.util.*;
import java.io.*;

public class sort {

	public static void main(String[] args) throws Exception {

		// Read in data.
		BufferedReader stdin = new BufferedReader(new FileReader("sort.in"));
		int n = Integer.parseInt(stdin.readLine().trim());
		item[] vals = new item[n];
		for (int i=0; i<n; i++) {
			int tmp = Integer.parseInt(stdin.readLine().trim());
			vals[i] = new item(tmp, i);
		}
		Arrays.sort(vals);

		// Key idea here is that small values can only move one spot per iteration...
		int res = 1;
		for (int i=0; i<vals.length; i++)
			res = Math.max(res, 1+vals[i].idx-i);

		// Write result.
		PrintWriter out = new PrintWriter(new FileWriter("sort.out"));
		out.println(res);
		out.close();
		stdin.close();
	}
}

class item implements Comparable<item> {

	public int val;
	public int idx;

	public item(int v, int i) {
		val = v;
		idx = i;
	}

	public int compareTo(item other) {
		if (this.val != other.val) return this.val - other.val;
		return this.idx - other.idx;
	}
}