import sys input = sys.stdin.readline from operator import itemgetter T=int(input()) for tests in range(T): N=int(input()) P=list(map(int,input().split())) P_INV=[-1]*N for i in range(N): P_INV[P[i]-1]=i ANS=1 A=[1]*N LANS=1 for i in range(N): x=P_INV[i] now=0 if x>0 and A[x-1]!=A[x]: now+=1 if x0 and A[x-1]!=A[x]: now2+=1 if x