#include int h[3000]; int dp[3000][2]; int tmp[3000][2]; int max(int a,int b){return a>b?a:b;} int main(){ int n,i; scanf("%d",&n); for(i=0;ih[l])tmp[l][0]=dp[r][1]+1; if(h[l]>h[r])tmp[r][1]=dp[l][0]+1; } for(int j=0;j