#include using namespace std; #define _for(i, l, r, vals...) \ for (decltype(l + r) i = (l), i##end = (r), ##vals; i <= i##end; ++i) template bool chkmin(T &a, T b) { return b < a ? a = b, true : false; } template bool chkmax(T &a, T b) { return a < b ? a = b, true : false; } auto solve() -> void { int n; cin >> n; int cnt0 = 0, cnt1 = 0; _for(i, 1, n, x) { cin >> x; (x & 1 ? cnt1 : cnt0)++; } cout << min(cnt0, cnt1) << '\n'; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int _t; cin >> _t; while (_t--) solve(); return 0; }