#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define INP(arr,n) for(int a=0;a<n;a++)cin>>arr[a]
#define OTP(arr,n) for(int a=0;a<n;a++)cout<<arr[a]<<" "
#define ll long long int
#define pb(v,a) v.push_back(a)
int main() {
IOS;int t=0;cin>>t;
while(t--) {
int n=0,ct=0;cin>>n;int arr[n];INP(arr,n);int l=*min_element(arr,arr+n);
for(int a=0;a<n;a++)
if(arr[a]==l)
ct++;
cout<<n-ct<<"\n";
}
}