Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.

Recently, Chef hosted a strange competition at the Byteland annual fair. There were $N$ participants in the competition (numbered $1$ through $N$); at the end of the competition, their scores were $A_{1}, A_{2}, \ldots, A_{N}$. Since it was a strange competition, negative scores were allowed too.

The *total score* of the competition is calculated as follows:
Divide the participants into one or more non-empty groups (subsets); if there are $K$ groups, let's denote them by $G_{1}, G_{2}, \ldots, G_{K}$. Each participant should be a member of exactly one group.
Sum up the scores of participants in each individual group. For each valid $i$, let's denote the sum of scores of participants in group $i$ by $X_{i}$.
The total score of the competition is the sum of squares of these summed up scores, i.e. $X_{1}^{2} + X_{2}^{2} + \ldots + X_{K}^{2}$.

Chef wants to choose the groups in such a way that the total score is maximum possible. Since there may be many ways to form the groups that lead to the maximum total score, Chef wants to know just the size of the largest group and the size of the smallest group which could be formed while still maximising the total score. These sizes are independent - formally, they are the maximum and minimum size $s$ of a group such that there is a way to form groups which maximises the total score and contains a group with size $s$.

------  Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first line of each test case contains a single integer $N$.
The second line contains $N$ space-separated integers $A_{1}, A_{2}, \ldots, A_{N}$.

------  Output ------
For each test case, print a single line containing two space-separated integers - the size of the largest possible group and the size of the smallest possible group.

------  Constraints  ------
$1 ≤ T ≤ 20$
$1 ≤ N ≤ 10^{5}$
$1 ≤ |A_{i}| ≤ 10^{9}$ for each valid $i$
the sum of $N$ over all test cases does not exceed $5 \cdot 10^{5}$

------  Subtasks ------
Subtask #1 (100 points): original constraints

----- Sample Input 1 ------ 
1

5

5 2 4 6 7
----- Sample Output 1 ------ 
5 5
----- explanation 1 ------ 
Example case 1: To maximise the total score, everyone has to belong to the same group with scores $[5, 2, 4, 6, 7]$. For this group, $X = 5+2+4+6+7 = 24$ and the total score is $24^{2} = 576$. The size of the largest possible group, as well as the size of the smallest possible group, is $5$.

Source: codechef | Difficulty: EASY
Tags: Mathematics


Solutions:
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l1 = list(filter(lambda x: x >= 0, l))
	l2 = list(filter(lambda x: x < 0, l))
	if len(l2) == 0:
		print(len(l1), len(l1))
	elif len(l1) == 0:
		print(len(l2), len(l2))
	else:
		print(max(len(l1), len(l2)), min(len(l1), len(l2)))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(pos, neg) = (0, 0)
	for i in a:
		if i > 0:
			pos += 1
		else:
			neg += 1
	if neg == 0:
		neg = pos
	print(pos, neg)


for _ in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	gmin = [x for x in s if x < 0]
	gmax = [x for x in s if x > 0]
	grps = [len(gmin) if gmin else n, len(gmax) if gmax else n]
	print(max(grps), min(grps))


for i in range(int(input())):
	N = int(input())
	lst = list(map(int, input().split()))
	p = []
	n = []
	for j in lst:
		if j > 0:
			p.append(j)
		else:
			n.append(j)
	sp = len(p)
	sn = len(n)
	if sp == 0:
		print(sn, sn)
	elif sn == 0:
		print(sp, sp)
	elif sp > sn:
		print(sp, sn)
	else:
		print(sn, sp)


for i in range(int(input())):
	n = int(input())
	(r, s) = (0, 0)
	a = list(map(int, input().split()))
	for i in a:
		if i > 0:
			r += 1
		else:
			s += 1
	if s == 0:
		s = r
	print(r, s)


t = int(input())
for tc in range(t):
	x = int(input())
	a = list(map(int, input().split()))
	p = 0
	n = 0
	for j in range(x):
		if a[j] > 0:
			p += 1
		else:
			n += 1
	if n == 0:
		print(p, p)
	elif p == 0:
		print(n, n)
	elif p >= n:
		print(p, n)
	else:
		print(n, p)


def s_L(n, l):
	neg = 0
	for i in l:
		if i < 0:
			neg += 1
	pos = n - neg
	if pos == n or neg == n:
		return [n, n]
	else:
		return [max(pos, neg), min(pos, neg)]
t = int(input())
for _ in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	print(*s_L(n, l))


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	count = 0
	for j in a:
		if j < 0:
			count = count + 1
	if count != 0:
		print(max(n - count, count), min(n - count, count))
	else:
		print(n, n)


for _ in range(int(input())):
	h = int(input())
	a = list(map(int, input().split()))
	maxsize = 0
	minsize = 0
	for i in a:
		if i < 0:
			minsize += 1
		else:
			maxsize += 1
	if minsize == 0:
		minsize = maxsize
	if maxsize == 0:
		maxsize = minsize
	print(maxsize, minsize)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(c, d) = (0, 0)
	for i in l:
		if i > 0:
			c += 1
		elif i < 0:
			d += 1
	if d == 0:
		print(c, c)
	else:
		print(c, d)


for tc in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	p = [i for i in a if i > 0]
	z = [i for i in a if i == 0]
	n = [i for i in a if i < 0]
	lens = [len(l) for l in (p, z, n) if len(l) > 0]
	print(max(lens), min(lens))


for i in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	a = []
	b = []
	for i in lis:
		if i > 0:
			a.append(i)
		else:
			b.append(i)
	if len(a) == n or len(b) == 0:
		print(n, n)
	else:
		print(max(len(a), len(b)), min(len(a), len(b)))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(l1, l2) = ([], [])
	for i in l:
		if i > 0:
			l1.append(i)
		else:
			l2.append(i)
	print(max(len(l1), len(l2)), min(len(l1), len(l2))) if len(l1) and len(l2) else print(max(len(l1), len(l2)), max(len(l1), len(l2)))


n = int(input())
for _ in range(n):
	N = int(input())
	lst = list(map(int, input().split()))
	positive = []
	negative = []
	for i in lst:
		if i > 0:
			positive.append(i)
		else:
			negative.append(i)
	positive = len(positive)
	negative = len(negative)
	if negative == 0:
		negative = positive
	print(max(positive, negative), min(positive, negative))


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(l1, l2) = ([], [])
	for x in l:
		if x >= 0:
			l1.append(x)
		else:
			l2.append(x)
	r1 = len(l1)
	r2 = len(l2)
	if r1 == 0 or r2 == 0:
		print(max(r1, r2), max(r1, r2))
	else:
		print(max(r1, r2), min(r1, r2))


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	x = []
	y = []
	for i in l:
		if i > 0:
			x.append(i)
		else:
			y.append(i)
	if len(x) == n or len(x) == 0:
		print(n, n)
	else:
		print(max(len(x), len(y)), min(len(x), len(y)))


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	a = []
	k = []
	sum1 = 0
	sum2 = 0
	for i in l:
		if i < 0:
			a.append(i)
	for i in l:
		if i > 0:
			k.append(i)
	if len(a) != 0 and len(k) != 0:
		for i in k:
			sum1 = sum1 + i
		for j in a:
			sum2 = sum2 + j
		if sum1 * sum1 > sum2 * sum2:
			print(len(k), len(a))
		else:
			print(len(a), len(k))
	elif len(a) == 0 and len(l) != 0:
		for i in k:
			sum1 = sum1 + i
		print(len(k), len(k))


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	(b, c) = ([], [])
	for i in a:
		if i > 0:
			b.append(i)
		else:
			c.append(i)
	(d, e) = (len(b), len(c))
	if d and e:
		print(max([d, e]), min([d, e]))
	else:
		print(max([d, e]), max([d, e]))


T = int(input())
for _ in range(T):
	n = int(input())
	A = list(map(int, input().split()))
	a = sum((1 for i in A if i < 0))
	b = n - a
	if a == n or a == 0:
		print(n, n)
	else:
		print(max(a, b), min(a, b))


import math
t = int(input())
for i in range(t):
	n = int(input())
	lst = []
	lst = list(map(int, input().split(' ')))[:n]
	neg = 0
	pos = 0
	for k in range(n):
		if lst[k] >= 0:
			pos += 1
		else:
			neg += 1
	if pos == 0 or neg == 0:
		print(f'{max(pos, neg)} {max(pos, neg)}')
	elif pos > neg:
		print(f'{pos} {neg}')
	else:
		print(f'{neg} {pos}')


for _ in range(int(input())):
	N = int(input())
	A = list(map(int, input().split()))
	M = sum((a > 0 for a in A))
	if N - M > 0:
		print(M, N - M)
	else:
		print(M, M)


class ChefNumberGame:

	def __init__(self, n: int, arr: list) -> None:
		self.__n = n
		self.__arr = arr

	def Solution(self) -> None:
		self.cnt = 0
		for i in self.__arr:
			if i < 0:
				self.cnt += 1
		if self.cnt == 0 or self.cnt == self.__n:
			print(self.__n, self.__n)
		elif self.cnt > abs(self.__n - self.cnt):
			print(self.cnt, self.__n - self.cnt)
		else:
			print(self.__n - self.cnt, self.cnt)
t = int(input())
assert t >= 1 and t <= 20
while t:
	n = int(input())
	arr = list(map(int, input().split(' ')))[:n]
	ans = ChefNumberGame(n, arr)
	ans.Solution()
	t -= 1


for _ in range(int(input())):
	N = int(input())
	poi = list(map(int, input().split()))
	(c, d) = (0, 0)
	for i in poi:
		if i < 0:
			c = c + 1
		else:
			d = d + 1
	if c == 0:
		print(d, d)
	else:
		print(max(c, d), min(c, d))


t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split()))
	x = sum([1 for i in a if i < 0])
	y = n - x
	if x == 0 or x == a:
		print(n, n, sep=' ')
	else:
		print(max(x, y), min(x, y), sep=' ')
	t = t - 1


for i in range(int(input())):
	a = int(input())
	l = list(map(int, input().split()))
	x = sum([1 for i in l if i < 0])
	y = a - x
	if x == 0 or x == a:
		print(a, a, sep=' ')
	else:
		print(max(x, y), min(x, y), sep=' ')


T = int(input())
for t in range(T):
	N = int(input())
	X = sorted(list((int(i) for i in input().split())))
	countNeg = 0
	for x in X:
		if x < 0:
			countNeg += 1
	if countNeg == 0:
		print(N, N)
	elif countNeg > N - countNeg:
		print(countNeg, N - countNeg)
	else:
		print(N - countNeg, countNeg)


t = int(input())
while t != 0:
	n = int(input())
	l = list(map(int, input().split()))
	c = 0
	for x in l:
		if x < 0:
			c += 1
	if c == 0:
		print(n, n)
	elif c > n - c:
		print(c, n - c)
	else:
		print(n - c, c)
	t -= 1


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(neg, pos) = (0, 0)
	for i in a:
		if i < 0:
			neg += 1
		else:
			pos += 1
	if neg == 0 or pos == 0:
		print(max(pos, neg), max(pos, neg))
	else:
		print(pos, neg)


t = int(input())
for ni in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	cp = 0
	xp = 0
	cn = 0
	xn = 0
	for i in l:
		if i > 0:
			cp = cp + 1
		else:
			cn = cn + 1
	if cp == 0:
		print(cn, cn)
	elif cn == 0:
		print(cp, cp)
	else:
		print(max(cp, cn), min(cp, cn))


t = int(input())
for i in range(t):
	num_elems = int(input())
	elems_list = map(int, input().split())
	negatives = sum((x < 0 for x in elems_list))
	if negatives == 0:
		print(f'{num_elems} {num_elems}')
	elif negatives > num_elems // 2:
		print(f'{negatives} {num_elems - negatives}')
	else:
		print(f'{num_elems - negatives} {negatives} ')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	ma = 0
	mi = 0
	for i in arr:
		if i > 0:
			ma += 1
		else:
			mi += 1
	if ma == 0:
		print(mi, mi)
	elif mi == 0:
		print(ma, ma)
	else:
		print(max(ma, mi), min(ma, mi))


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	p = 0
	m = 0
	for i in a:
		if i > 0:
			p += 1
		else:
			m += 1
	if m == 0:
		print(p, p)
	elif p == 0:
		print(m, m)
	else:
		print(max(m, p), min(m, p))


n = int(input())
for _ in range(n):
	k = int(input())
	l = list(map(int, input().split()))
	p = 0
	m = 0
	for i in l:
		if i > 0:
			p += 1
		else:
			m += 1
	if m == 0:
		print(p, p)
	elif p == 0:
		print(m, m)
	else:
		print(max(m, p), min(m, p))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	neg = 0
	pos = 0
	for num in a:
		if num < 0:
			neg += 1
		else:
			pos += 1
	n1 = max(neg, pos)
	n2 = min(neg, pos)
	if neg == 0 or pos == 0:
		n2 = n1
	print(n1, n2, sep=' ')


for i in range(int(input())):
	N = int(input())
	a = list(map(int, input().split()))
	a1 = []
	a2 = []
	for j in range(N):
		if a[j] > 0:
			a1.append(a[j])
		elif a[j] < 0:
			a2.append(a[j])
	n1 = 0
	n1 = len(a1)
	n2 = n1
	if len(a2) > 0:
		n2 = len(a2)
	print(f'{n1} {n2}')


for __ in range(int(input())):
	ni = int(input())
	n = p = 0
	l = [int(i) for i in input().split(' ')]
	for i in l:
		if i < 0:
			n += 1
		else:
			p += 1
	if n == 0:
		n = p
	if p > n:
		print(p, n)
	else:
		print(n, p)


for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	maxx = 0
	minn = 0
	for i in lis:
		if i > 0:
			maxx += 1
		else:
			minn += 1
	if min(maxx, minn == 0):
		minn = maxx
	print(max(maxx, minn), min(maxx, minn))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	posi = 0
	nega = 0
	for v in a:
		if v > 0:
			posi += 1
		else:
			nega += 1
	if nega == 0:
		print(posi, posi)
	elif posi == 0:
		print(nega, nega)
	else:
		print(max(nega, posi), min(nega, posi))


for i in range(int(input())):
	k = int(input())
	l = list(map(int, input().split()))[:k]
	(p, s) = (0, 0)
	for i in l:
		if i > 0:
			p += 1
		else:
			s += 1
	if s == 0:
		print(p, p)
	elif p == 0:
		print(s, s)
	elif p > s:
		print(p, s)
	else:
		print(s, p)


T = int(input())
for t in range(0, T):
	N = int(input())
	A = map(int, input().split())
	(neg, nul, pos) = (0, 0, 0)
	for a in A:
		neg += int(a < 0)
		nul += int(a == 0)
		pos += int(a > 0)
	print(max(neg, pos) + nul, 1 if nul > 0 else neg if neg > 0 and neg < pos else pos)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	p = 0
	n = 0
	for i in l:
		if i > 0:
			p += 1
		else:
			n += 1
	if n == 0:
		print(p, p)
	elif p == 0:
		print(n, n)
	elif p > n:
		print(p, n)
	else:
		print(n, p)


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	pos = 0
	neg = 0
	for i in l:
		if i > 0:
			pos += 1
		elif i < 0:
			neg += 1
	if pos == 0 or neg == 0:
		print(max(pos, neg), max(pos, neg))
	else:
		print(max(pos, neg), min(pos, neg))


T = int(input())
for i in range(T):
	n = int(input())
	li = list(map(int, input().split()))
	li.sort()
	ln = []
	lp = []
	s = 0
	for i in li:
		if i < 0:
			ln.append(i)
		else:
			lp.append(i)
	ma = len(lp)
	mi = len(ln)
	if len(ln) == 0:
		mi = ma
	print(ma, mi)


for _ in range(int(input())):
	N = int(input())
	(p, n) = (0, 0)
	for ai in list(map(int, input().split())):
		if ai > 0:
			p += 1
		else:
			n += 1
	if p == 0:
		print(n, n)
	elif n == 0:
		print(p, p)
	elif p >= n:
		print(p, n)
	else:
		print(n, p)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	(pos, neg) = (0, 0)
	for i in arr:
		if i > 0:
			pos += 1
		else:
			neg += 1
	if pos == n or neg == n:
		print(n, n)
	else:
		print(max(pos, neg), min(pos, neg))


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	pos_len = 0
	neg_len = 0
	for i in l:
		if i > 0:
			pos_len += 1
		elif i < 0:
			neg_len += 1
	if pos_len == 0 or neg_len == 0:
		print(max(pos_len, neg_len), max(pos_len, neg_len))
	else:
		print(max(pos_len, neg_len), min(pos_len, neg_len))


for _ in range(int(input())):
	input()
	arr = map(int, input().split())
	pos = 0
	neg = 0
	for i in arr:
		if i > 0:
			pos += 1
		else:
			neg += 1
	if neg and pos:
		print(max(pos, neg), min(pos, neg))
	elif pos:
		print(pos, pos)
	else:
		print(neg, neg)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))[:n]
	c = 0
	b = 0
	for i in arr:
		if i <= 0:
			c += 1
		else:
			b += 1
	if b == n or c == n:
		print(n, n)
	else:
		print(max(c, b), min(c, b))


def solve(n, lst):
	(pos, neg) = (0, 0)
	for i in lst:
		if i < 0:
			neg += 1
		else:
			pos += 1
	if neg == 0 or pos == 0:
		print(max(pos, neg), max(pos, neg))
	else:
		print(max(pos, neg), min(pos, neg))
for _ in range(int(input())):
	n = int(input())
	solve(n, list(map(int, input().split())))


for i in range(int(input())):
	x = int(input())
	a = list(map(int, input().split()))
	(p, n) = ([], [])
	for i in range(x):
		if a[i] >= 0:
			p.append(a[i])
		else:
			n.append(a[i])
	if len(p) == 0:
		print(x, end=' ')
		print(x)
	elif len(n) == 0:
		print(x, end=' ')
		print(x)
	else:
		print(max(len(p), len(n)), end=' ')
		print(min(len(p), len(n)))


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	u = 0
	v = 0
	for j in range(n):
		if a[j] < 0:
			v += 1
		elif a[j] > 0:
			u += 1
	if u == 0 or v == 0:
		print(max(u, v), max(u, v))
	else:
		print(max(u, v), min(u, v))


T = int(input())
for _ in range(T):
	N = int(input())
	L = sorted(list(map(int, input().split())))
	minus = plus = 0
	for i in L:
		if i < 0:
			minus += 1
		elif i > 0:
			plus += 1
	if minus == 0 or plus == 0:
		minus = plus
	print(plus, minus)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	v = list(map(int, input().split(' ')))
	s1 = 0
	s2 = 0
	t1 = 0
	t2 = 0
	for i in v:
		if i > 0:
			t1 += 1
		else:
			t2 += 1
	if t1 == 0:
		print(t2, t2)
	elif t2 == 0:
		print(t1, t1)
	else:
		print(t1, t2)


T = int(input())
for _ in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	maxsize = 0
	minsize = 0
	for i in A:
		if i < 0:
			minsize += 1
		elif i > 0:
			maxsize += 1
	if minsize == 0:
		minsize = maxsize
	if maxsize == 0:
		maxsize = minsize
	print(maxsize, minsize)


T = int(input())
while T:
	T = T - 1
	N = int(input())
	Scores = list(map(int, input().split()))
	poscount = 0
	negcount = 0
	for i in Scores:
		if i > 0:
			poscount = poscount + 1
		else:
			negcount = negcount + 1
	if negcount == 0:
		negcount = poscount
	elif poscount == 0:
		poscount = negcount
	print(max(poscount, negcount), min(poscount, negcount))


for i in range(int(input())):
	n = int(input())
	li = list(map(int, input().split(' ')))
	(small, large) = ([], [])
	for i in li:
		if i < 0:
			small.append(i)
		elif i >= 0:
			large.append(i)
	if len(small) == 0 or len(large) == 0:
		print(max(len(small), len(large)), max(len(small), len(large)))
	else:
		print(max(len(small), len(large)), min(len(small), len(large)))


t = int(input())
for i in range(t):
	c = int(input())
	d = list(map(int, input().split()))
	f = 0
	g = 0
	for j in d:
		if j > 0:
			f += 1
		else:
			g += 1
	if f == 0 or g == 0:
		print(str(max(f, g)) + ' ' + str(max(f, g)))
	else:
		print(str(max(f, g)) + ' ' + str(min(f, g)))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ps = 0
	ns = 0
	for ele in l:
		if ele > 0:
			ps += 1
		else:
			ns += 1
	if ps == 0 or ns == 0:
		print(str(max(ps, ns)) + ' ' + str(max(ps, ns)))
	else:
		print(str(max(ps, ns)) + ' ' + str(min(ps, ns)))


for _ in range(int(input())):
	N = int(input())
	A = list(map(int, input().split()))
	l = []
	l2 = []
	for val in A:
		if val < 0:
			l.append(val)
		else:
			l2.append(val)
	if len(l) == 0:
		print(len(l2), len(l2))
	elif len(l2) == 0:
		print(len(l), len(l))
	else:
		print(max(len(l), len(l2)), min(len(l), len(l2)))


t = int(input())
while t > 0:
	n = int(input())
	list1 = list(map(int, input().split()))
	listp = list(filter(lambda x: x > 0, list1))
	list0 = list(filter(lambda x: x == 0, list1))
	listn = list(filter(lambda x: x < 0, list1))
	listm = []
	if len(listp) + len(list0) >= len(listn) + len(list0):
		print(len(listp) + len(list0), end=' ')
	else:
		print(len(listn) + len(list0), end=' ')
	if len(listp) != 0:
		listm.append(len(listp))
	if len(listn) != 0:
		listm.append(len(listn))
	if len(list0) != 0:
		listm.append(len(list0))
	print(min(listm))
	t = t - 1


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	pos = 0
	ne = 0
	for i in l:
		if i > 0:
			pos = pos + 1
		else:
			ne = ne + 1
	if pos == 0:
		print(ne, ne)
	elif ne == 0:
		print(pos, pos)
	else:
		print(max(ne, pos), min(pos, ne))


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	pos = [x for x in l if x >= 0]
	neg = [x for x in l if x < 0]
	len_pos = len(pos)
	len_neg = len(neg)
	if len_pos > 0 and len_neg > 0:
		print(str(max(len_pos, len_neg)), ' ', str(min(len_neg, len_pos)))
	else:
		print(str(max(len_neg, len_pos)), ' ', str(max(len_pos, len_neg)))


t = int(input())
for l in range(t):
	input()
	cp = cn = 0
	listx = list(map(int, input().split()))
	for m in listx:
		if m > 0:
			cp += 1
		elif m < 0:
			cn += 1
	if cp == 0 or cn == 0:
		print(str(max(cp, cn)) + ' ' + str(max(cp, cn)))
	else:
		print(str(max(cp, cn)) + ' ' + str(min(cp, cn)))


for _ in range(int(input())):
	N = int(input())
	arr = list(map(int, input().split()))
	pos_count = 0
	neg_count = 0
	for i in range(len(arr)):
		if arr[i] >= 0:
			pos_count += 1
		elif arr[i] < 0:
			neg_count += 1
	if pos_count == len(arr):
		print(pos_count, pos_count)
	elif neg_count == len(arr):
		print(neg_count, neg_count)
	elif pos_count >= neg_count:
		print(pos_count, neg_count)
	elif neg_count > pos_count:
		print(neg_count, pos_count)


N = int(input())
for _ in range(N):
	n = int(input())
	scores = sorted(list(map(int, input().split())))
	pos = 0
	neg = 0
	for i in scores:
		if i < 0:
			neg += 1
		if i > 0:
			pos += 1
	if pos == 0:
		pos = neg
	if neg == 0:
		neg = pos
	print(pos, neg)