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

gra = [1]*n
Max = 1

for i in range(1,n):
    for j in range(i):
        if num[j]<num[i] and gra[j]>=Max:
            Max = gra[j]
            gra[i] = Max+1

print(max(gra))