# 最大上升子序LIS
def lengthOfLIS(lst):
    dp = [1] * len(lst)
    for i in range(len(lst)):
        for j in range(i):
            if lst[i] > lst[j]:
                dp[i] = max(dp[i], dp[j] + 1)
    return max(dp)

while True:
    try:
        n, nums = int(input()), list(map(int, input().split()))
        print(lengthOfLIS(nums))
    except:
        break