n = int(input())
parent = [-1]*n
def root(x):
	if parent[x] < 0:
		return x
	parent[x] = y = root(parent[x])
	return y
def union(x, y):
	px = root(x)
	py = root(y)
	if px == py:
		return
	if px > py:
		px = root(y)
		py = root(x)
	parent[x] += parent[y]
	parent[y] = px
	return
	
Q = []
for i in range(n):
	a = int(input())
	for j in range(i):
		if Q[-j-1] < a:
			union(Q[-j-1], a)
			continue
		continue
	Q += [a]
print(-min(parent))
