#include #include #include using namespace std; struct cmp{ bool operator()(const pair& a, const pair& b){ if(a.first != b.first) return a.first > b.first; return a.second < b.second; } }; int main(){ int n; cin >> n; vector a(n); for(int i = 0; i < n; i++){ cin >> a[i]; } //dp[i]->数列前i个的最长上升子列 pair(长度, 最大值) vector dp(n, 1); for(int i = 0; i < n; i++){ for(int j = 0; j < i; j++){ if(a[i] > a[j]) dp[i] = max(dp[i], dp[j] + 1); } } int m = *max_element(dp.begin(), dp.end()); cout << m << endl; return 0; }