#include<bits/stdc++.h>
using namespace std;
#define int 		  	long long
#define f(i,n)        	for(int i=0;i<(n);++i)
#define fa(i,a,n)     	for(int i=a;i<=(n);++i)
#define fd(i,a,n)     	for(int i=a;i>=(n);--i)
#define tc 			  	int t;cin>>t;f(testcase,t)
#define ld				long double
#define pii             pair<int,int>
#define mem(a,i)		memset(a,i,sizeof(a))
#define all(x) 			x.begin(),x.end()
#define tr(c,i) 		for(auto i = c.begin(); i != c.end(); i++)
#define present(c,x) 	(c.find(x) != c.end())
#define cpresent(c,x) 	(find(allc,x) != c.end())
#define	PI 3.1415926535897932
void c_p_c() {
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
}

void solve() {
	int n;
	cin >> n;
	int a[n];

	map<int, int> m;
	f(i, n) {
		cin >> a[i];
		m[a[i]]++;

	}
	cout << n - m.begin()->second << "\n";
}
int32_t main() {

	c_p_c();
	tc
	solve();
	return 0;
}

