include[HTML_REMOVED]
using namespace std;
int a[100005],dp[100005];
int main(){
int n,i,j;
cin>>n;
for(i=1;i<=n;i) cin>>a[i];
for(i=1;i<=n;i){
dp[i]=1;
for(j=1;j[HTML_REMOVED]a[j]) dp[i]=max(dp[i],dp[j]+1);
}
sort(dp+1,dp+1+n);
cout<<dp[n];
return 0;
}
```