n = int(input())
a = []
for i in range(n):
    a.append( int(input()) )
#dp[i]:a[i]が最後になる数列の最大長

dp = [1 for j in range(n)]

for i in range(n):
    for j in range(i):
        if a[i] > a[j]:
            dp[i] = max(dp[i],dp[j]+1 )
        else:
            dp[i] = max(1,dp[i])
        #print(i,j,dp[i])
print(max(dp))

