def lentotal(nums):
L = [1] * a
for i in reversed(range(a)):
for j in range(i+1,a):
if nums[i] < nums[j]:
L[i] = max(L[i],L[j]+1)
return max(L)
while True:
try:
a = int(input())
b = list(map(int,input().split()))
print(lentotal(b))
except:
break