n = int(input())

arr = []

for i in range(n):
	arr.append(int(input()))


dp = [0 for i in range(n)]

for i in range(n):
	dp[i] = 1
	for j in range(i):
		if arr[i] > arr[j]:
			dp[i] = max(dp[i], dp[j] + 1)

print dp[n-1]

