#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;
int main(){
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while (t--){
int n, x, ans = 0;
cin >> n;
vector<int> a, b, c;
for (int i = 0; i < n; i++){
cin >> x;
if (x > 0) a.push_back(x);
if (x < 0) b.push_back(x);
if (x == 0) c.push_back(x);
}
while (b.size() > 1 && a.size() > 0){
ans++;
b.pop_back();
b.pop_back();
a.pop_back();
}
while (a.size() > 2){
a.pop_back();
a.pop_back();
a.pop_back();
ans++;
}
int z = 0;
int p = a.size(), q = b.size(), r = c.size();
for (int i = 1; i <= r; i++){
if (i * 2 <= p + q){
z = i;
} else {
break;
}
}
p = p + q;
p -= (2 * z), r -= z;
z = 0;
if (r > 0){
for (int i = 1; i <= p; i++){
if (i * 2 <= r){
z = i;
} else {
break;
}
}
p -= z, r -= (2 * z);
}
if (p > 0) ans -= p / 3;
cout << ans << endl;
}
}