#include <iostream>

using namespace std;
int v[105];
int main()
{
    int t,n,i,j,minn=101;
    cin>>t;
    for(j=1;j<=t;j++)
    {
        minn=101;
        cin>>n;
        for(i=1;i<=n;i++)
        {
            cin>>v[i];
            if(v[i]<minn)
            {
                minn=v[i];
            }
        }
        int gigel=0;
        for(i=1;i<=n;i++)
        {
            if(v[i]==minn)
                gigel++;
        }
        cout<<n-gigel<<'\n';
    }
    return 0;
}
