#include <iostream>
#include <string> 
#include <vector> 
#include <cmath> 
#include <map>

using namespace std;

int main()
{
    int t;
    cin>>t; 
    while (t--)
    {
        int n; 
        cin>>n; 
        vector <int> vec(n);
        int min=101; 
        for (int i=0;i<n;i++)
        {
            cin>>vec[i];
            if (vec[i]<min)
            min=vec[i]; 
        }
        int count=0; 
        for (int i=0;i<n;i++)
        if (min==vec[i])
        count++; 
        cout<<n-count<<endl;
    }
    return 0;
}
