import sys

while True:
    try:
        n = int(input())
        lst = list(map(int,input().split()))
        ans = 1
        rec = [1]*n
        for i in range(1,n):
            temp = 1
            for j in range(i):
                if lst[j]< lst[i] and rec[j] >= temp:
                    temp = rec[j] + 1
            rec[i]  = temp
            if rec[i] >= ans:
                ans =rec[i]
        print(ans)
    except:
        break