#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int a[101];
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		memset(a,0,sizeof a);
		int n;
		cin>>n;
		int count1=101;
		for(int i=1;i<=n;i++)
		{
			int x;
			cin>>x;
			a[i]=x;
			count1=min(count1,x);
		}
		int count2=0;
		for(int i=1;i<=n;i++)
		{
			if(count1==a[i])
			count2++;
		}
		cout<<(n-count2)<<endl;
	}
}