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
	Q += [a]
print(-min(parent))


"""
import bisect
N = int(input())
A = [int(input()) for _ in range(N)]
L = [A[0]]
for a in A[1:]:
    if L[-1] < a:
        L.append(a)
    else:
        L[bisect.bisect_left(L, a)] = a
print(len(L))
"""
