n = int(input())
a = [int(input()) for i in range(n)]

def lis_linear(a, n):
    dp = [0 for i in range(n)]
    for i in range(n):
        max_val = 1
        for j in range(i):
            if max_val < dp[j]: max_val = dp[j]
            if a[j] < a[i] and max_val < dp[j] + 1: max_val = dp[j] + 1
        dp[i] = max_val
    return dp[-1]

print(lis_linear(a, n))
