n = int(input())
A = []
dp = [0 for _  in range(n)]
dp[0] = 1
for i in range(n):
    num = int(input())
    A.append(num)
    dpmax = 0
    for j in range(i):
        if A[j] < num and dp[j] > dpmax:
            dpmax = dp[j]
    dp[i] = max(dpmax + 1,1)    
print(dp[-1])
    