#include using namespace std; #define ll long long #define rep(i,n) for(int i=0;i> N; vector a(N+2,0); vector b(N+2,0); rep(i,N) cin >> a[i+1]; if(N==2){ cout << 0 << " " << 1 << endl; return 0; } rep(i,N){ if(a[i]>a[i+2]) chmax(b[i],a[i+1]); else chmax(b[i+2],a[i+1]); } ll tim = 0,cnt = 0; ll l = 0,r = 0,om = 0,em = 0,oi = 0,ei = 0; rep(i,N+2){ if(b[i]==0){ if(l!=0){ ll m1 = min(oi,ei),m2 = max(oi,ei); ll tmp = 0; ll lw = m1-l,rw = r-m2,ct = m2-m1-1; tmp = max(lw,rw) + ct/2; cnt++; chmax(tim,tmp+1); } l = 0,r = 0,om = 0,em = 0; } else{ if(l==0) l = i; r = i; if(i%2==0&&b[i]>em){ em = b[i]; ei = i; } if(i%2==1&&b[i]>om){ om = b[i]; oi = i; } } } cout << tim << " " << cnt << endl; }