You are given $n$ integers $a_1, a_2, \ldots, a_n$. You choose any subset of the given numbers (possibly, none or all numbers) and negate these numbers (i. e. change $x \to (-x)$). What is the maximum number of different values in the array you can achieve?


-----Input-----

The first line of input contains one integer $t$ ($1 \leq t \leq 100$): the number of test cases.

The next lines contain the description of the $t$ test cases, two lines per a test case.

In the first line you are given one integer $n$ ($1 \leq n \leq 100$): the number of integers in the array.

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($-100 \leq a_i \leq 100$).


-----Output-----

For each test case, print one integer: the maximum number of different elements in the array that you can achieve negating numbers in the array.


-----Examples-----

Input
3
4
1 1 2 2
3
1 2 3
2
0 0
Output
4
3
1


-----Note-----

In the first example we can, for example, negate the first and the last numbers, achieving the array $[-1, 1, 2, -2]$ with four different values.

In the second example all three numbers are already different.

In the third example negation does not change anything.

Difficulty: EASY
Tags: Implementation

Starter code:

Solutions:
def task():
	n = int(input())
	a = set()
	w = [int(i) for i in input().split()]
	for i in w:
		if i in a:
			a.add(-i)
		else:
			a.add(i)
	print(len(a))

def main():
	n = int(input())
	for _ in range(n):
		task()
main()


for _ in range(int(input())):
	n = int(input())
	d = {}
	for i in list(map(int, input().split())):
		if abs(i) in d:
			d[abs(i)] += 1
		else:
			d[abs(i)] = 1
	ans = 0
	for i in list(d.keys()):
		if i == 0:
			ans += 1
		elif d[i] == 1:
			ans += 1
		else:
			ans += 2
	print(ans)


for _ in range(int(input())):
	n = int(input())
	t = 0
	lsx = []
	ls = list(map(int, input().split()))
	for i in range(len(ls)):
		if ls[i] not in lsx:
			lsx.append(ls[i])
			t += 1
		elif -ls[i] not in lsx:
			lsx.append(-ls[i])
			t += 1
	print(t)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = [0 for i in range(101)]
	b[0] = 1
	ans = 0
	for j in a:
		if b[abs(j)] < 2:
			b[abs(j)] += 1
			ans += 1
	print(ans)


for t in range(int(input())):
	n = int(input())
	A = [int(i) for i in input().split()]
	d = dict()
	(count, dount) = (0, 0)
	A1 = set()
	for i in A:
		if i in d:
			if -i in d:
				pass
			else:
				d[-i] = 1
		else:
			d[i] = 1
	print(len(d))


t = int(input())
for i in range(t):
	n = int(input())
	S = [int(i) for i in input().split()]
	A = set()
	for i in range(n):
		if S[i] not in A:
			A.add(S[i])
		else:
			S[i] = -S[i]
	print(len(set(S)))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = set(a)
	c = 0
	for i in b:
		if i == 0:
			c += 1
		elif -i not in b:
			x = a.count(i)
			if x == 1:
				c += 1
			else:
				c += 2
		else:
			c += 1
	print(c)


def func(n, arr):
	d = {}
	for i in arr:
		if i in d.keys():
			d[i] += 1
		else:
			d[i] = 1
	s = set()
	for k in d.keys():
		if d[k] == 1:
			s.add(-1 * k)
		else:
			s.add(k)
			s.add(-1 * k)
	return len(s)
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().strip().split()))
	print(func(n, arr))


t = int(input())
while t > 0:
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	for i in l:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	count = 0
	for i in d:
		if i != 0 and -1 * i not in d:
			if d[i] == 1:
				count += 1
			elif d[i] > 1:
				count += 2
		else:
			count += 1
	print(count)
	t = t - 1


import math as mt
for _ in range(int(input())):
	x = [0 for i in range(101)]
	n = int(input())
	l = [int(i) for i in input().split()]
	for i in l:
		x[abs(i)] += 1
	ans = 0
	if x[0] >= 1:
		ans += 1
	for i in x[1:]:
		if i >= 2:
			ans += 2
		elif i == 1:
			ans += 1
	print(ans)


from math import *
import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

class Solution:

	def __init__(self):
		self.ans = 0

	def solve(self, a, n):
		obj = {}
		ans = 0
		for i in range(n):
			if a[i] < 0:
				a[i] = -a[i]
			if a[i] in obj.keys():
				obj[a[i]] += 1
				if obj[a[i]] == 2 and a[i]:
					ans += 1
			else:
				obj[a[i]] = 1
				ans += 1
		return ans
sol = Solution()
t = inp()
k = t
ans = []
while t:
	n = inp()
	a = inlt()
	ans.append(sol.solve(a, n))
	t -= 1
for i in range(k):
	print(ans[i])


tst = int(input())
for i in range(tst):
	n = int(input())
	a = map(int, input().split())
	b = set()
	for i in a:
		if i in b:
			b.add(-i)
		else:
			b.add(i)
	print(len(b))


t = int(input())
for i in range(t):
	n = int(input())
	z = list(map(int, input().split()))
	s = set()
	for i in z:
		if i in s:
			s.add(-i)
		else:
			s.add(i)
	print(len(s))


for _ in range(int(input())):
	n = int(input())
	s = set()
	a = list(map(int, input().split()))
	for i in a:
		if i in s:
			if -i not in s:
				s.add(-i)
		else:
			s.add(i)
	print(len(s))


def diverse(nums, size):
	nums.sort()
	for i in range(size - 1):
		if nums[i] == nums[i + 1]:
			nums[i] *= -1
	return len(set(nums))
for _ in range(int(input())):
	size = int(input())
	nums = list(map(int, input().split()))
	print(diverse(nums, size))


for i in range(int(input())):
	n = int(input())
	data = set()
	for x in map(int, input().split()):
		if x in data:
			data.add(-x)
		else:
			data.add(x)
	print(len(data))


t = int(input())
while t:
	t -= 1
	n = int(input())
	li = list(map(int, input().strip().split()))
	d = {}
	for i in li:
		if i not in d:
			d[i] = i
		else:
			i = i * -1
			d[i] = i
	print(len(d))
print


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	for i in l:
		if abs(i) in d:
			d[abs(i)] += 1
		else:
			d[abs(i)] = 1
	count = 0
	for i in d:
		if d[i] >= 2 and i != 0:
			count += 2
		else:
			count += 1
	print(count)


for s in [*open(0)][2::2]:
	t = set()
	for x in map(int, s.split()):
		t |= {(x, -x)[x in t]}
	print(len(t))


for _ in range(int(input())):
	n = input()
	a = list(map(int, input().split()))
	s = set()
	s.add(a[0])
	for i in a[1:]:
		if i not in s:
			s.add(i)
		elif -i not in s:
			s.add(-i)
	print(len(s))


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a = list(map(abs, a))
	ad = list(set(a))
	flag = 0
	for j in range(len(ad)):
		if a.count(ad[j]) > 1 and ad[j] != 0:
			flag = flag + 2
		else:
			flag = flag + 1
	print(flag)


def input_taker():
	t = int(input())
	str_sets = []
	sets = []
	for _ in range(t):
		input()
		str_sets.append(input())
	for str_set in str_sets:
		sets.append(list(map(int, str_set.split())))
	return sets

def analyser(a_set):
	nums = set()
	l = 0
	for num in a_set:
		if num not in nums:
			l += 1
			nums.add(num)
		elif -num not in nums:
			l += 1
			nums.add(-num)
	return l

def c_1616A():
	in_sets = input_taker()
	for items in in_sets:
		print(analyser(items))
c_1616A()


t = int(input())
for inh in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	s = set()
	if len(set(a)) == len(a):
		print(len(a))
	else:
		for i in a:
			if i in s:
				i = -i
				s.add(i)
			s.add(i)
		print(len(s))


out = []

def playoff():
	n = int(input())
	lst = list(map(int, input().split()))
	lst2 = []
	for i in range(len(lst)):
		if lst[i] in lst2:
			lst2.append(-1 * lst[i])
		lst2.append(lst[i])
	out.append(len(set(lst2)))
iter = int(input())
while iter > 0:
	playoff()
	iter -= 1
for i in range(0, len(out)):
	print(out[i])


t = int(input())
for _ in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	s = set()
	for i in l:
		if i not in s:
			s.add(i)
		else:
			s.add(-i)
	print(len(s))


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	d = {}
	ans = 0
	for i in range(n):
		if arr[i] < 0:
			arr[i] *= -1
	for item in arr:
		if item not in d and item != 0:
			d[item] = 1
		elif item in d:
			d[item] += 1
	for item in d.values():
		if item == 2 or item == 1:
			ans += item
		elif item >= 3:
			ans += 2
	x = 0
	if x in arr:
		ans += 1
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	for j in range(1, n):
		if a[j] == a[j - 1]:
			a[j] = -a[j]
	a.sort()
	c = 1
	for j in range(1, n):
		if a[j] != a[j - 1]:
			c += 1
	print(c)


def main():
	n = input()
	c = list(map(int, input().split()))
	d = [0] * 101
	for i in c:
		d[abs(i)] += 1
	vid = 0
	if d[0] > 0:
		vid += 1
	for i in range(1, 101):
		if d[i] == 1:
			vid += 1
		if d[i] > 1:
			vid += 2
	print(vid)
for i in range(int(input())):
	main()


t = int(input())
for _ in range(t):
	n = int(input())
	ans = []
	cnt = 0
	lst = list(map(int, input().split()))
	for i in lst:
		if i in ans:
			if -i not in ans:
				cnt += 1
				ans.append(-i)
		else:
			cnt += 1
			ans.append(i)
	print(cnt)


import sys

def solve():
	inp = sys.stdin.readline
	n = int(inp())
	d = dict()
	for i in map(int, inp().split()):
		d[abs(i)] = d.get(abs(i), 0) + 1
	r = 0
	for i in d:
		if i == 0:
			r += min(d[i], 1)
		else:
			r += min(d[i], 2)
	print(r)

def main():
	for i in range(int(sys.stdin.readline())):
		solve()
main()


from sys import stdin

def solve():
	for _ in range(int(stdin.readline().strip())):
		N = int(stdin.readline().rstrip())
		A = sorted(list(map(int, stdin.readline().rstrip().split())))
		for i in range(1, N):
			if A[i] == A[i - 1]:
				A[i] *= -1
		print(len(set(A)))
solve()


n = int(input())
for i in range(n):
	m = int(input())
	s = set()
	cnt = 0
	a = [int(x) for x in input().strip().split(' ')]
	for num in a:
		if num not in s:
			s.add(num)
			cnt += 1
		elif -1 * num not in s:
			s.add(-1 * num)
			cnt += 1
	print(cnt)


def find(n, L):
	mydict = {}
	for elem in L:
		x = abs(int(elem))
		try:
			mydict[x] += 1
		except:
			mydict[x] = 1
	sum = 0
	for key in mydict:
		if key != 0:
			sum += min(2, mydict[key])
		else:
			sum += 1
	return sum
cases = int(input())
for _ in range(cases):
	n = int(input())
	L = input().split()
	print(find(n, L))


for _ in range(int(input())):
	n = int(input())
	freq = {}
	for num in (*map(int, input().split()),):
		num = abs(num)
		freq[num] = freq.get(num, 0) + 1
	count = 0
	for key in freq:
		if key == 0:
			count += 1
		elif freq[key] == 1:
			count += 1
		else:
			count += 2
	print(count)


import sys
input = sys.stdin.readline
from collections import Counter
import math
n = int(input())
for _ in range(n):
	t = int(input())
	arr = list(map(int, input().split()))
	for j in range(len(arr)):
		arr[j] = abs(arr[j])
	C = Counter(arr)
	ans = 0
	for key in C:
		if key == 0:
			ans += 1
		else:
			ans += min(2, C[key])
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	new = []
	for i in a:
		if i not in new:
			new += [i]
		elif i == 0 and 0 not in new:
			new += [i]
		elif -i not in new and i != 0:
			new += [-i]
	print(len(new))


for _ in range(int(input())):
	n = int(input())
	a = list(map(lambda x: abs(int(x)), input().split()))
	cnt = {}
	ans = 0
	for elem in a:
		if elem not in cnt:
			cnt[elem] = 0
		cnt[elem] += 1
		if cnt[elem] == 2 and elem:
			ans += 1
	ans += len(cnt)
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	for i in range(len(l)):
		l[i] = abs(l[i])
	d = {}
	c = 0
	for i in range(len(l)):
		if l[i] not in d:
			d[l[i]] = 1
			c += 1
		elif d[l[i]] == 1 and l[i] != 0:
			d[l[i]] = 2
			c += 1
	print(c)


import heapq
import sys
import math
from collections import deque
from bisect import bisect_left, bisect_right
I = sys.stdin.readline
II = lambda : int(I())
IN = lambda x: map(int, x.split())
FN = lambda x: map(float, x.split())
L = lambda x: list(IN(x))
M = 1000000007
P = print
T = True
F = False
for _ in range(II()):
	n = II()
	a = L(I())
	d = {}
	for i in a:
		d[abs(i)] = d.get(abs(i), 0) + 1
	c = 0
	for (u, v) in d.items():
		if v > 1:
			c += 1
		c += 1
	if d.get(0, 0) > 1:
		c -= 1
	print(c)


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_list_string():
	return list(map(str, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()

def get_int():
	return int(sys.stdin.readline().strip())

def get_print_int(x):
	sys.stdout.write(str(x) + '\n')

def get_print(x):
	sys.stdout.write(x + '\n')

def get_print_int_same(x):
	sys.stdout.write(str(x) + ' ')

def get_print_same(x):
	sys.stdout.write(x + ' ')
from sys import maxsize

def solve():
	for _ in range(get_int()):
		n = get_int()
		arr = get_list()
		d = dict()
		for i in range(n):
			if arr[i] not in d:
				d[arr[i]] = 1
			else:
				d[arr[i]] += 1
		ans = 0
		for (k, v) in d.items():
			if v <= 1:
				ans += v
			elif k == 0:
				ans += 1
			elif -1 * k not in d:
				ans += 2
			else:
				ans += 1
		get_print_int(ans)
solve()


import sys
sys.setrecursionlimit = 200000
from collections import Counter
for _ in range(int(input())):
	N = int(input())
	A = list(map(int, input().split()))
	C = Counter(A)
	ans = len(C)
	for c in C:
		if c != 0 and C[c] > 1 and (-c not in C):
			ans += 1
	print(ans)


import sys
for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = f = 0
	d = {}
	for i in a:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	for i in d:
		if d[i] > 1 and i != 0 and (i * -1 not in d):
			c += 2
		else:
			c += 1
	print(c)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a = list(map(lambda x: abs(x), a))
	b = [min(a.count(x), 1) if x == 0 else min(a.count(x), 2) for x in range(101)]
	ans = sum(b)
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	for i in range(n):
		if l[i] not in d:
			d[l[i]] = 1
		elif -l[i] not in d:
			d[-l[i]] = 1
	print(len(d))


for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	dp = {}
	for i in arr:
		if i in dp:
			dp[i] += 1
		else:
			dp[i] = 1
	ans = 0
	for i in dp:
		if i == 0:
			ans += 1
		elif dp[i] == 1:
			ans += 1
		else:
			if -i in dp:
				ans += 1
				continue
			ans += 2
	print(ans)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	s = set()
	for e in arr:
		a = -1 * e
		if e in s:
			s.add(a)
		else:
			s.add(e)
	print(len(s))


for _ in range(int(input())):
	sdf = input()
	l = [int(i) for i in input().split()]
	d = dict()
	for i in range(len(l)):
		if l[i] in d:
			l[i] = -l[i]
		d[l[i]] = 1
	print(len(set(l)))


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	x = Counter(l)
	ans = 0
	for i in x:
		if i == 0:
			ans += 1
		elif x[i] >= 2 and -1 * i not in x:
			ans += 2
		else:
			ans += 1
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	numbers = {}
	a = list(map(int, input().split()))
	for x in a:
		x = abs(x)
		if x not in numbers:
			numbers[x] = 1
		else:
			numbers[x] += 1
	count = 0
	for (x, c) in numbers.items():
		if c == 1 or x == 0:
			count += 1
		else:
			count += 2
	print(count)


def CountFrequency(my_list):
	freq = {}
	for item in my_list:
		if item in freq:
			freq[item] += 1
		else:
			freq[item] = 1
	return freq
for i in range(int(input())):
	n = int(input())
	a = [int(j) for j in input().split()]
	freq = CountFrequency(a)
	cnt = 0
	for j in freq:
		if freq[j] == 1:
			cnt += 1
		elif freq[j] > 1 and -j not in freq and (j != 0):
			cnt += 2
		else:
			cnt += 1
	print(cnt)


t = int(input())
for i in range(t):
	count = 0
	arr1 = set()
	arr2 = set()
	n = int(input())
	for j in input().split():
		j = abs(int(j))
		if j not in arr1:
			arr1.add(j)
			count += 1
		elif j not in arr2 and j != 0:
			arr2.add(j)
			count += 1
	print(count)


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	d = defaultdict(lambda : 0)
	for i in A:
		d[i] += 1
	ans = 0
	for i in d.keys():
		if i == 0:
			ans += 1
		elif d[i] > 1:
			k = -i
			if k not in d.keys():
				ans += 2
			else:
				ans += 1
		else:
			ans += 1
	print(ans)


t = int(input()) + 1
while (t := (t - 1)):
	n = int(input())
	nums = list(map(int, input().split()))
	check = set()
	for num in nums:
		if num not in check:
			check.add(num)
		elif -num not in check:
			check.add(-num)
	print(len(check))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = []
	for i in range(n):
		if a[i] not in c:
			c.append(a[i])
		elif -a[i] not in c:
			c.append(-a[i])
	print(len(c))


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	hmap = {}
	ans = 0
	for i in range(n):
		if arr[i] in hmap:
			hmap[arr[i]] += 1
		else:
			hmap[arr[i]] = 1
	for (i, j) in hmap.items():
		if i != 0 and j > 1 and (i * -1 not in hmap):
			ans += 2
		else:
			ans += 1
	print(ans)


def solve():
	n = int(input())
	arr = [*map(int, input().split())]
	tg = set()
	for x in arr:
		if x in tg:
			tg.add(-x)
		else:
			tg.add(x)
	print(len(tg))
t = int(input())
for _ in range(t):
	solve()


from collections import Counter
for _ in range(int(input())):
	input()
	nums = Counter(list(map(abs, list(map(int, input().split())))))
	ans = 0
	for i in nums:
		if i == 0:
			ans += 1
			continue
		if nums[i] >= 2:
			ans += 2
		else:
			ans += 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	for i in range(n):
		x[i] = abs(x[i])
	x = sorted(x)
	ans = 1
	flag = True
	temp = x[0]
	for i in range(1, n):
		if x[i] == temp and x[i] != 0 and (flag == True):
			flag = False
			ans += 1
		elif x[i] != temp:
			flag = True
			ans += 1
			temp = x[i]
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	d = {}
	for i in a:
		if i not in d:
			d[i] = 1
		else:
			d[i] += 1
	result = 0
	for i in d:
		if i == 0 or -i in d:
			d[i] = min(d[i], 1)
		else:
			d[i] = min(d[i], 2)
		result += d[i]
	print(result)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	l = set()
	for item in a:
		if item not in l:
			l.add(item)
		elif -item not in l:
			l.add(-item)
	print(len(l))


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	cnt = Counter(a)
	ans = 0
	s = set()
	for each in cnt.items():
		if each[1] >= 2:
			s.add(each[0])
			s.add(-each[0])
		else:
			s.add(each[0])
	print(len(s))


def solver():
	n = int(input())
	for i in range(n):
		d = {}
		len_list = int(input())
		numbers = list(sorted(list(map(abs, list(map(int, input().split()))))))
		for a in numbers:
			d[a] = d.get(a, 0) + 1
		for j in d.keys():
			if d[j] >= 2:
				d[j] = 2
		if d.get(0, 0) > 1:
			d[0] = 1
		print(sum(d.values()))
solver()


t = int(input())
for test in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	d = dict()
	ans = 0
	for i_sign in l:
		i = abs(i_sign)
		if i in d:
			if d[i] == 1 and i != 0:
				ans += 1
			d[i] += 1
		else:
			d[i] = 1
			ans += 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	k = set(l)
	c = 0
	for i in k:
		if l.count(i) >= 2 and i != 0 and (l.count(-i) == 0):
			c += 2
		else:
			c += 1
	print(c)


def solve(v):
	d = {}
	for i in v:
		i = abs(i)
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	s = 0
	for i in d:
		if i == 0:
			s += 1
		else:
			s += min(2, d[i])
	return s
n = int(input())
for i in range(n):
	x = int(input())
	v = map(int, input().split())
	print(solve(v))


for _ in range(int(input())):
	n = int(input())
	b = dict()
	a = list(map(int, input().split()))
	for i in a:
		if i in b:
			b[-i] = 1
		else:
			b[i] = 1
	print(len(b))


T = int(input())
for _ in range(T):
	n = int(input())
	s = list(map(int, input().split()))
	S = []
	for i in range(n):
		if s[i] in S:
			S.append(s[i] * -1)
		else:
			S.append(s[i])
	print(len(set(S)))


t = int(input())
for step in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	q = []
	for i in range(0, n):
		if q.count(abs(a[i])) <= 1 and a[i] != 0 or (q.count(a[i]) < 1 and a[i] == 0):
			q.append(abs(a[i]))
	print(len(q))


t = int(input())
ans = []
one = 0
zero = 0
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	val = dict()
	for i in range(n):
		one += 0
		zero *= 1
		if abs(a[i]) not in val:
			val[abs(a[i])] = 1
		else:
			val[abs(a[i])] += 1
	cnt = 0
	one += 0
	zero *= 1
	for ele in val:
		if ele == 0:
			cnt += 1
		else:
			cnt += min(val[ele], 2)
		one += 0
		zero *= 1
	print(cnt)


for t in range(int(input())):
	n = input()
	memo = [0 for _ in range(101)]
	a = list(map(int, input().split(' ')))
	for i in range(len(a)):
		if a[i] < 0:
			memo[-a[i]] += 1
		elif a[i] > 0:
			memo[a[i]] += 1
		else:
			memo[0] = 1
	sum = 0
	for i in range(len(memo)):
		sum += min(2, memo[i])
	print(sum)


t = int(input())
for testcase in range(t):
	n = int(input())
	integer_list = input().split(' ')
	check_list = []
	for i in range(n):
		if int(integer_list[i]) not in check_list:
			check_list.append(int(integer_list[i]))
		elif int(integer_list[i]) * -1 not in check_list:
			check_list.append(int(integer_list[i]) * -1)
	print(len(check_list))


t = int(input())
for i in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	dic = {}
	for j in range(-100, 101):
		dic[j] = 0
	for k in lst:
		if dic[k] >= 1:
			dic[-k] += 1
		else:
			dic[k] += 1
	c = 0
	for p in dic.keys():
		if dic[p] > 0:
			c += 1
	print(c)


from collections import Counter
import sys
input = sys.stdin.readline
num_test_cases = int(input())
for test_case_ittr in range(num_test_cases):
	n = int(input())
	arr = [int(x) for x in input().strip().split()]
	count = Counter(arr)
	ans = 0
	if count[0] > 0:
		ans += 1
	del count[0]
	processed = {0}
	for x in count:
		if x in processed:
			continue
		if count[x] + count[-x] > 1:
			ans += 2
		else:
			ans += 1
		processed.update({x, -x})
	print(ans)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	cnt = {}
	for i in arr:
		val = abs(i)
		cnt[val] = cnt[val] + 1 if val in cnt else 1
	res = 0
	for i in cnt:
		if i > 0:
			res += min(2, cnt[i])
		else:
			res += min(1, cnt[i])
	print(res)


solutions = []
t = int(input())
for x in range(0, t):
	d = 0
	integers = []
	n = int(input())
	input_two = list(input().split())
	for x in input_two:
		y = int(x)
		integers.append(y)
	for x in set(integers):
		if x != 0:
			if -x not in integers:
				if integers.count(x) > 1:
					d += 1
	solve = len(set(integers)) + d
	solutions.append(solve)
for x in solutions:
	print(x)


n = int(input())
sp = []
sp1 = []
spi = []
for i in range(n):
	a = int(input())
	s = list(map(int, input().split()))
	for t in s:
		if t not in sp1:
			sp1.append(t)
		elif -t not in sp1:
			sp1.append(-t)
		else:
			pass
	spi.append(len(sp1))
	sp1.clear()
for o in spi:
	print(o)


def tack():
	n = int(input())
	data = input().split()
	d = dict()
	for x in data:
		d[x] = d[x] + 1 if x in d.keys() else 1
	ans = 0
	for x in d:
		if (d[x] >= 2 and x != '0') and str(-int(x)) not in d.keys():
			ans += 2
		else:
			ans += 1
	print(ans)

def main():
	n = int(input())
	for x in range(n):
		tack()
main()


t = int(input())
for j in range(t):
	n = int(input())
	l = list(map(abs, map(int, input().split())))
	s = set(l)
	count = 0
	for i in s:
		if i == 0:
			count += 1
		elif l.count(i) > 2:
			count += 2
		else:
			count += l.count(i)
	print(count)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [abs(int(x)) for x in input().split(' ')]
	d = {}
	for x in arr:
		if x not in d:
			d[x] = 0
		d[x] += 1
	total_diff = len(d)
	for k in d:
		if d[k] > 1 and k != 0:
			total_diff += 1
	print(total_diff)


T = int(input())
while T:
	n = int(input())
	s = input()
	s = s.split()
	for i in range(len(s)):
		s[i] = int(s[i])
	d = {}
	for i in s:
		if i not in d:
			d[i] = 0
		d[i] = d[i] + 1
	a = len(d)
	flag = {}
	for i in d:
		if d[i] > 1:
			if -i not in d and i not in flag and (-i not in flag):
				flag[i] = True
				flag[-i] = True
				a = a + 1
	print(a)
	T = T - 1


def do(arr):
	l1 = len(arr)
	arr2 = set(arr)
	l2 = len(arr2)
	c = 0
	for i in arr2:
		if arr.count(i) > 1 and i != 0 and (arr.count(-i) == 0):
			c += 1
	total_elements = c + l2
	print(total_elements)
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	do(arr)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	for j in a:
		if abs(j) not in d:
			d[abs(j)] = 1
		else:
			d[abs(j)] += 1
	ans = 0
	for (k, v) in d.items():
		if v > 1 and k != 0:
			ans += 2
		else:
			ans += 1
	print(ans)


def solve(arr, n):
	count = 0
	rec = dict()
	for i in arr:
		if i not in rec:
			rec[i] = 1
			count += 1
		else:
			if i == 0:
				continue
			elif -i in rec:
				continue
			rec[-i] = 1
			count += 1
	return count
t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	ans = solve(arr, n)
	print(ans)


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().strip().split()))
	d = {}
	for j in a:
		i = j
		if j < 0:
			i = j * -1
		if i in d:
			if i == 0:
				continue
			d[i] += 1
		else:
			d.update({i: 1})
	count = 0
	for i in d.keys():
		if d[i] == 1:
			count += 1
		else:
			count += 2
	print(count)


from collections import Counter
ans = []
for _ in range(int(input())):
	n = int(input())
	nums = list(map(int, input().split()))
	count = Counter(nums)
	cnt = 0
	for (k, v) in count.items():
		if v > 1 and k != 0 and (-k not in count):
			cnt += 1
		cnt += 1
	ans.append(cnt)
print(*ans, sep='\n')


import sys
from math import sqrt, gcd
from collections import deque
sys.setrecursionlimit(10 ** 8)
I = lambda : int(input())
S = lambda : input().strip()
M = lambda : map(int, input().strip().split())
L = lambda : list(map(int, input().strip().split()))
mod = 1000000007
for _ in range(I()):
	n = I()
	l = L()
	d = {}
	for i in l:
		if abs(i) in d:
			d[abs(i)] += 1
		else:
			d[abs(i)] = 1
	ans = 0
	for i in d:
		if d[i] == 1 or i == 0:
			ans += 1
		else:
			ans += 2
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	d = dict()
	for i in range(n):
		if a[i] not in d:
			d[a[i]] = 1
		else:
			d[a[i]] += 1
	c = 0
	for i in d:
		if i == 0:
			c += 1
		elif d[i] != 1000:
			if -i in d:
				c += 2
				d[-i] = 1000
			elif d[i] >= 2:
				c += 2
			else:
				c += 1
	print(c)