#include < iostream > using namespace std; #define MAX 20 void Missile( int current, int step, int index, int lastindex); int height[MAX],MaxCount,t; int main() { while(cin>>height[t++]) if(20==t) break; t--; Missile(0,0,0,-1); cout<<MaxCount<<' '; MaxCount=0; Missile(0,1,0,-1); cout<<MaxCount<<endl; return 0;} void Missile( int current, int step, int index, int lastindex) // step=0:decrease,step=1:increase { if(current>MaxCount) MaxCount=current; if(t==index)return; if((index+1-current)<(t-MaxCount)) { index++; Missile(current,step,index,lastindex); index--; } if(-1==lastindex || (step ? height[index]>=height[lastindex] : height[index]<=height[lastindex])) { lastindex=index++; Missile(++current,step,index,lastindex); }}