#include<bits/stdc++.h>
#define REG register
using namespace std;
const int N=105;
inline void read(int& x){
	static char c;
	while(!isdigit(c=getchar()));x=c^48;
	while(isdigit(c=getchar()))x=(x*10)+(c^48);
}

int T,n;
int A[N];

inline void Work(){
	read(T);
	while(T--){
		read(n);
		for(REG int i=1;i<=n;++i) read(A[i]);
		sort(A+1,A+n+1);
		int now=1;
		while(now<=n&&A[now]==A[1]) ++now;
		if(now>n) puts("0");
		else printf("%d\n",n-now+1);
	}
}

int main(){Work();}
