# 输入示例
n = int(input().strip())
nums = [0]
nums.extend(list(map(int, input().split())))
# 初始化dp数组
dp = [0 for i in range(n+1)]
for i in range(1,n+1):
dp[i] = 1
for j in range(1,i):
# dp[i] = 1 !!! 注意,出错了,初始化dp[i]不能放在内循环里,否则在执行内循环时dp[i]会不断初始化为1
if nums[j]<nums[i]:
dp[i] = max(dp[i], dp[j]+1)
res = 0
for i in range(n+1):
res = max(res, dp[i])
print(res)