#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <cstring>
#include <cstring>

using namespace std;
     
typedef long long ll;
typedef string ss;
 
#define pb push_back
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pii pair < int, int >

const int N = 1e2 + 5, INF = int(1e9), mod = 998244353, base = 1;

int q, n, m, a[N];

int main(){
    speed;
	cin >> q;
	while(q--){
		cin >> n;
		int mi = INF, ans = 0;
		for(int i = 1; i <= n; i++){
			cin >> a[i];
			mi = min(a[i], mi);
		}
		for(int i = 1; i <= n; i++){
			if(a[i] > mi){
				ans++;
			}
		}
		cout << ans << "\n";
	}
}
