#include using namespace std; const int maxi=1e6+10; stack st; int dl[maxi],dr[maxi],l[maxi],r[maxi],a[maxi]; void solve() { int n; cin>>n; int mm=0; for (int i=1;i<=n;i++){ scanf("%d",&a[i]); mm=max(mm,a[i]); } if (mm==a[1] || mm==a[n]) { printf("1\n"); return; } for (int i=1;i<=n;i++){ while(!st.empty() && a[i]>a[st.top()]){ r[st.top()]=i; st.pop(); } st.push(i); } while(!st.empty()){ r[st.top()]=n+1; st.pop(); } for (int i=n;i>0;i--){ while(!st.empty() && a[i]>a[st.top()]){ l[st.top()]=i; st.pop(); } st.push(i); } while(!st.empty()){ l[st.top()]=0; st.pop(); } dr[n+1]=0; dl[0]=0; for (int i=1;i<=n;i++) dl[i]=dl[l[i]]+1; for (int i=n;i>0;i--) dr[i]=dr[r[i]]+1; int ans=1e6; for (int i=1;i>t; while(t--) solve(); return 0; }