/* Name of the class has to be “Main” only if the class is public. */
class codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
int n=sc.nextInt();
int x[]=new int[n];
int ans=0;
int max=Integer.MAX_VALUE;
for(int i=0;i<n;i++){
x[i]=sc.nextInt();
if(x[i]<=max)
{
max=x[i];
ans++;
}
}
System.out.println(ans);
}
}
}