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