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

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

for i in range(max_a):
    dp[n][i]=0

i=n-1
while i>=0:
    for j in range(max_a):
        if j>=a[i]:
            dp[i][j]=0
        else:
            dp[i][j]=max(dp[i+1][j],dp[i+1][a[i]]+1)
    i-=1
if dp[0][0]==0:
    print(1)
else:
    print(dp[0][0])