#include using namespace std; typedef long long int ll; typedef unsigned long long ull; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); ll myRand(ll B) { return (ull)rng() % B; } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int q; cin >> q; while(q--){ int n; cin >> n; vector a(n); for(int i=0;i> a[i]; } ll res=0; auto ok=[&](int i)->bool{ if(i-1<0 or i+1>=n)return false; if(a[i]==a[i-1] or a[i-1]==a[i+1] or a[i+1]==a[i])return false; if(a[i]>a[i-1] and a[i]>a[i+1])return true; if(a[i] dp(n+1); for(int i=0;i