N = int(input())
numbers = []
for i in range(N):
    numbers.append(int(input()))

lis = [numbers[0]]
for last in numbers[1:]:
    for i, item in enumerate(lis):
        if last < item:
            lis = lis[:i] + [last] + lis[i+1:]
            break
    if lis[-1] < last:
        lis.append(last)

print(len(lis))