#include using namespace std; using Int=long long; using Real=long double; templateinline bool chmin(T&A,S B){return(A>B?A=B,1:0);} templateinline bool chmax(T&A,S B){return(A>N>>a>>b; REP(i,N-2) { cin>>c; if(a!=b&&a!=c&&b!=c&&(max(a,max(b,c))==b||min(a,min(b,c))==b))++ans; a=b,b=c; } cout<>T; while(T--)sol(); }