代码:
#include<iostream>
#include<stdio.h>
using namespace std;
const int maxn = 1001;
int a[maxn],dp[maxn];
int main(){
int n;
cin>>n;
for(int i=1;i<=n;i++){
scanf("%d",&a[i]);
dp[i] =1;
}
int ans = 0;
for(int i=1;i<=n;i++){
for(int j=i+1;j<=n;j++){
if(a[j]>a[i]){
dp[j] = max(dp[j],dp[i]+1);
}
}
}
for(int i=1;i<=n;i++)
ans = max(ans,dp[i]);
cout<<ans<<endl;
return 0;
}