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

#define ll long long
#define ld long double
#define ar array
#define F first
#define S second

#define vt vector
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()

#define r_ep(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define r_ep1(e) r_ep(i, 0, e, 1)
#define r_ep2(i, e) r_ep(i, 0, e, 1)
#define r_ep3(i, b, e) r_ep(i, b, e, 1)
#define r_ep4(i, b, e, s) r_ep(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define r_epc(...) GET5(__VA_ARGS__, r_ep4, r_ep3, r_ep2, r_ep1)
#define rep(...) r_epc(__VA_ARGS__)(__VA_ARGS__)
#define each(x, a) for (auto& x: a)

template<class T> void read(T& x) {
	cin >> x;
}
template<class H, class... T> void read(H& h, T&... t) {
	read(h);
	read(t...);
}
template<class A> void read(A *x, int size) {
	rep(size)
		read(x[i]);
}
template<class A> void read(vt<A>& x) {
	each(a, x)
		read(a);
}

template<class T> void print(T& x) {
	cout << x << ' ';
}
template<class H, class... T> void print(H& h, T&... t) {
	print(h);
	print(t...);
}
template<class A> void print(A *x, int size) {
	rep(size)
		print(x[i]);
	cout << '\n';
}
template<class A> void print(vt<A>& x) {
	each(a, x)
		print(a);
}

template<class H, class... T> void debug(H& h, T&... t) {
	print(h, t...);
	cout << endl;
}

const int d4i[4]={-1, 0, 1, 0}, d4j[4]={0, 1, 0, -1};
const int d8i[8]={-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8]={0, 1, 1, 1, 0, -1, -1, -1};

const int N = 101, mod = 1e9+7;

void solve() {
	int n, val, minv = N, cnt;
	read(n);
	rep(n) {
		read(val);
		if(minv>val)
			minv = val, cnt = 1;
		else if(minv==val)
			cnt++;
	}
	cout << n-cnt << '\n';
}

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    int _t; cin >> _t; while(_t--)
    solve();
}