n=int(input())
l=list(map(int,input().split()))
a=[1 for i in range(n)]
for i in range(1,n):
    for j in range(i):
        if l[j]<l[i]:
            a[i]=max(a[j]+1,a[i])
print(max(a))