//################
//# ------------ #
//# NoName270805 #
//# ------------ #	
//################
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
//GNU G++17 7.3.0: No long long for faster code
//GNU G++17 9.2.0 (64 bit, msys 2): Long long only for faster code
#include<bits/stdc++.h>
using namespace std;
#define superfastboy ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define tests int t;cin>>t;while(t--)
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define mp make_pair
#define int long long
#define ll long long
#define ull unsigned long long
typedef vector<int> vi;
typedef pair<int,int> pii;
ll const inf=1e15+7,mod=1e9+7,p=10;
ll const N=270805;
void solve(){
	int n;
	cin>>n;
	int a[n+5],tmp=105;
	for(int i=0;i<n;i++){
		cin>>a[i];
		tmp=min(tmp,a[i]);
	}
	int ans=0;
	for(int i=0;i<n;i++){
		if(tmp!=a[i])ans++;
	}
	cout<<ans<<"\n";
}	
signed main(){
//	freopen(".inp","r",stdin);
//	freopen(".out","w",stdout);
	superfastboy
	tests
	solve();
}