#include<bits/stdc++.h>
using namespace std;

int main(){
	long s,n,tmp,z;
	cin>>s;

	while(s){
		vector<long> ls;
		cin>>n;
		z =n;
		while(n){
			cin>>tmp;
			ls.push_back(tmp);
			n--;
		}
		sort(ls.begin(),ls.end());
		
		tmp = 0;
		for(int x = 1; x<z;x++){
			if ((ls[0]+ls[x])/2 <ls[x]){
			tmp = z-x;
			break;}
		}
		
		cout<<tmp<<endl;
		s--;
		
	}
	
	
}

