#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define nl "\n"
#define ws " "
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define MOD 1000000007
typedef vector<ll> vi;
typedef vector<pair<ll, ll>> vii;
int main () {
FASTIO
int t;
cin>>t;
while (t--) {
int m;
cin>>m;
ll p = 0, n = 0, z = 0;
for (int i = 0; i < m; i++) {
int x;
cin>>x;
if (x > 0) {
p++;
} else if (x < 0) {
n++;
} else {
z++;
}
}
ll pp = p, nn = n, zz = z;
ll sc1 = p / 3;
p -= (sc1 * 3);
ll x = min (n / 2, p);
sc1 += x;
n -= x * 2;
p -= x;
ll y = min (n / 2, z);
n -= y * 2;
z -= y;
ll h = min ({n, p, z});
n -= h;
p -= h;
z -= h;
ll e = min (n, z / 2);
n -= e;
z -= e * 2;
ll f = n / 3;
n -= f * 3;
sc1 -= f;
sc1 -= n;
//cout<<"sc1 = "<<sc1<<nl;
ll sc2 = min (nn / 2, pp);
nn -= sc2 * 2;
pp -= sc2;
x = pp / 3;
sc2 += x;
pp -= x * 3;
y = min (nn / 2, zz);
nn -= y * 2;
zz -= y;
h = min ({nn, pp, zz});
nn -= h;
pp -= h;
zz -= h;
e = min (nn, zz / 2);
nn -= e;
zz -= e * 2;
f = nn / 3;
nn -= f * 3;
sc2 -= f;
sc2 -= nn;
//cout<<"sc2 = "<<sc2<<nl;
cout<<max (sc1, sc2)<<nl;
}
return 0;
}