n = int(input()) ls = list(map(int,input().split())) dp = [1]*len(ls) def f(ls): lst = [1]*(len(ls)) for i in range(len(ls)-1,-1,-1): for j in range(i+1,len(ls)): if ls[j] > ls[i]: dp[i] = max(dp[i],dp[j]+1) return max(dp) print(f(ls))