n = int(input())
array = [int(input()) for _ in range(n)]
dp = [0] * n

for i, ai in enumerate(array):
    dp[i] = max((dp[j] for j, aj in enumerate(array[:i]) if aj < ai), default=0) + 1

print(max(dp))