#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN = 500000;
struct node
{
int i;
bool is;
bool operator < (const node& x)const
{
return i>x.i;
}
};
int main()
{
int T;
int n;
struct node a[MAXN];
scanf("%d",&T);
while(T--)
{
scanf("%d",&n);
for(int i=0;i<n;i++)
{
int j;
scanf("%d",&j);
if(j>0)
{
a[i].i=j;
a[i].is=0;
}
else
{
a[i].i=-j;
a[i].is=1;
}
}
sort(a,a+n);
int cnt=0;
bool l=a[0].is;
for(int i=0;i<n;i++)
if(l==a[i].is)
{
l=!l;
cnt++;
}
printf("%d\n",cnt);
}
}
#include<algorithm>
using namespace std;
const int MAXN = 500000;
struct node
{
int i;
bool is;
bool operator < (const node& x)const
{
return i>x.i;
}
};
int main()
{
int T;
int n;
struct node a[MAXN];
scanf("%d",&T);
while(T--)
{
scanf("%d",&n);
for(int i=0;i<n;i++)
{
int j;
scanf("%d",&j);
if(j>0)
{
a[i].i=j;
a[i].is=0;
}
else
{
a[i].i=-j;
a[i].is=1;
}
}
sort(a,a+n);
int cnt=0;
bool l=a[0].is;
for(int i=0;i<n;i++)
if(l==a[i].is)
{
l=!l;
cnt++;
}
printf("%d\n",cnt);
}
}