def dfs(index,prev,n,a,dp):
    if dp[index][prev] != -1:
        return dp[index][prev]

    if index==n:
        return 0

    if prev>=a[index]:
        return 0

    ren=max(dfs(index+1,prev,n,a,dp),dfs(index+1,a[index],n,a,dp)+1)
    dp[index][prev]=ren
    return ren

n=int(input())
a=[0 for i in range(n)]

for i in range(n):
    a[i]=int(input())
dp=[[-1 for i in range(max(a)+1)] for j in range(n+1)]

print(dfs(0,0,n,a,dp))