Guy-Manuel and Thomas have an array $a$ of $n$ integers [$a_1, a_2, \dots, a_n$]. In one step they can add $1$ to any element of the array. Formally, in one step they can choose any integer index $i$ ($1 \le i \le n$) and do $a_i := a_i + 1$.

If either the sum or the product of all elements in the array is equal to zero, Guy-Manuel and Thomas do not mind to do this operation one more time.

What is the minimum number of steps they need to do to make both the sum and the product of all elements in the array different from zero? Formally, find the minimum number of steps to make $a_1 + a_2 +$ $\dots$ $+ a_n \ne 0$ and $a_1 \cdot a_2 \cdot$ $\dots$ $\cdot a_n \ne 0$.


-----Input-----

Each test contains multiple test cases. 

The first line contains the number of test cases $t$ ($1 \le t \le 10^3$). The description of the test cases follows.

The first line of each test case contains an integer $n$ ($1 \le n \le 100$) — the size of the array.

The second line of each test case contains $n$ integers $a_1, a_2, \dots, a_n$ ($-100 \le a_i \le 100$) — elements of the array .


-----Output-----

For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero.


-----Example-----
Input
4
3
2 -1 -1
4
-1 0 0 1
2
-1 2
3
0 -2 1

Output
1
2
0
2



-----Note-----

In the first test case, the sum is $0$. If we add $1$ to the first element, the array will be $[3,-1,-1]$, the sum will be equal to $1$ and the product will be equal to $3$.

In the second test case, both product and sum are $0$. If we add $1$ to the second and the third element, the array will be $[-1,1,1,1]$, the sum will be equal to $2$ and the product will be equal to $-1$. It can be shown that fewer steps can't be enough.

In the third test case, both sum and product are non-zero, we don't need to do anything.

In the fourth test case, after adding $1$ twice to the first element the array will be $[2,-2,1]$, the sum will be $1$ and the product will be $-4$.

Source: codeforces | Difficulty: EASY
Tags: Mathematics

Implementation


Solutions:
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	d = 0
	d = d + l.count(0)
	if sum(l) + d == 0:
		d = d + 1
	print(d)


from sys import stdin

def solve(a):
	(ans, i, N, psum, nsum) = (0, 0, len(a), 0, 0)
	for i in range(N):
		(ans, a[i]) = (ans + 1 if a[i] == 0 else ans, 1 if a[i] == 0 else a[i])
	for i in range(N):
		(psum, nsum) = (psum + a[i] if a[i] >= 0 else psum, nsum + a[i] if a[i] < 0 else nsum)
	if psum == abs(nsum):
		ans += 1
	return ans

def main():
	t = int(stdin.readline().strip())
	for _ in range(t):
		stdin.readline().strip()
		a = [int(x) for x in stdin.readline().strip().split()]
		print(solve(a))
main()


test = int(input())
while test != 0:
	n = int(input())
	arr = list(map(int, input().split()))
	summ = 0
	p = 1
	for i in range(n):
		summ += arr[i]
		p *= arr[i]
	if summ != 0 and p != 0:
		print(0)
	else:
		steps = 0
		summ = 0
		for i in range(n):
			if arr[i] == 0:
				arr[i] += 1
				steps += 1
		for i in range(n):
			summ += arr[i]
		if summ == 0:
			steps += 1
		print(steps)
	test -= 1


t = int(input())
for i in range(t):
	n = int(input())
	lst = [int(i) for i in input().split()]
	(z, s, t) = (0, 0, 0)
	for j in lst:
		if j == 0:
			z += 1
		else:
			s += j
	if z == 0:
		if s == 0:
			print(1)
		else:
			print(0)
	else:
		t = z
		s += z
		if s == 0:
			print(t + 1)
		else:
			print(t)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = 0
	for i in range(n):
		if a[i] == 0:
			m += 1
			a[i] += 1
	if sum(a) == 0:
		m += 1
	print(m)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	steps = 0
	n0 = 0
	for i in l:
		if i == 0:
			n0 += 1
	steps += n0
	if sum(l) + steps == 0:
		steps += 1
	print(steps)


def pro(x):
	p = 1
	for i in range(len(x)):
		p *= x[i]
	return p
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	x = 0
	if sum(a) != 0 and pro(a) != 0:
		print(0)
	else:
		x = a.count(0)
		for i in range(len(a)):
			if a[i] == 0:
				a[i] = 1
		while sum(a) == 0:
			a[a.index(min(a))] += 1
			x += 1
		print(x)


cases = int(input())
while cases:
	cases -= 1
	num = int(input())
	arr = list(map(int, input().split()))
	x = arr.count(0)
	if sum(arr) + x * 1 == 0:
		print(x + 1)
	else:
		print(x)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s = sum(l)
	if s != 0 and 0 not in l:
		print(0)
	elif 0 in l:
		c = l.count(0)
		s = s + c
		if s != 0:
			print(c)
		else:
			print(c + 1)
	else:
		print(1)


t = int(input())
for i in range(t):
	steps = 0
	i = 0
	l = int(input())
	arr = list(map(int, input().split(' ')))
	for i in range(l):
		if arr[i] == 0:
			arr[i] = 1
			steps = steps + 1
	if sum(arr) == 0:
		steps = steps + 1
	print(steps)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def main():
	t = I()
	rr = []
	for _ in range(t):
		n = I()
		a = LI()
		s = sum(a)
		r = 0
		for c in a:
			if c == 0:
				r += 1
		if s + r == 0:
			r += 1
		rr.append(r)
	return JA(rr, '\n')
print(main())


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	c = 0
	for i in range(n):
		if a[i] == 0:
			c += 1
			a[i] += 1
	j = 0
	while sum(a) == 0:
		a[j] += 1
		j += 1
		c += 1
	print(c)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s = 0
	k = 0
	for j in range(n):
		if a[j] == 0:
			a[j] += 1
			k += 1
		s += a[j]
	if s == 0:
		k += 1
	print(k)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(input().split())
	a = [int(i) for i in a]
	count = 0
	p = 1
	for i in range(n):
		if a[i] == 0:
			count += 1
			a[i] += 1
	for i in range(n):
		p = p * a[i]
	if sum(a) == 0 or p == 0:
		count += 1
	print(count)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(cnt, ns, np, nz) = (0, 0, 0, 0)
	for i in range(len(l)):
		if l[i] < 0:
			ns += l[i]
		elif l[i] > 0:
			np += l[i]
		else:
			nz += 1
	if nz > 0:
		su = ns + np + nz
		if su == 0:
			cnt = nz + 1
		else:
			cnt = nz
	elif ns + np == 0:
		cnt = 1
	else:
		cnt = 0
	print(cnt)


import collections, heapq

def main():
	T = int(input().strip())
	for _ in range(T):
		n = int(input().strip())
		aStr = input().strip()
		a = [int(x) for x in aStr.split(' ')]
		s = sum(a)
		zeros = a.count(0)
		s += zeros
		if s != 0:
			print(zeros)
		else:
			print(zeros + 1)
main()


def prod(li):
	p = 1
	for i in li:
		p *= i
	return p
t = int(input())
for i in range(t):
	n = int(input())
	li = list(map(int, input().split()))
	if sum(li) != 0 and prod(li) != 0:
		print(0)
	else:
		l = 0
		while prod(li) == 0:
			if li.count(0) != 0:
				li[li.index(0)] = 1
				l = l + 1
		while sum(li) == 0:
			li[0] = li[0] + 1
			l = l + 1
		print(l)


t = int(input())
for _ in range(t):
	n = int(input())
	y = list(map(int, input().split()))
	i = cnt = 0
	while i < n:
		if y[i] == 0:
			y[i] += 1
			cnt += 1
		i += 1
	if sum(y) == 0:
		cnt += 1
	print(cnt)


import math
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	cz = 0
	for i in range(n):
		if a[i] == 0:
			cz += 1
	ans = cz
	c = sum(a)
	if c + cz == 0:
		print(cz + 1)
	else:
		print(cz)


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c = 0
	w = 0
	f = 0
	l1 = []
	l2 = []
	for j in range(n):
		if l[j] == 0:
			l[j] += 1
			w += 1
		if l[j] == -1:
			c += 1
	k = sum(l)
	if k == 0:
		print(w + 1)
	else:
		print(w)


def nonzero(arr):
	prod = 1
	for i in arr:
		prod *= i
	if sum(arr) and prod:
		return 0
	count = 0
	for i in range(len(arr)):
		if not arr[i]:
			count += 1
			arr[i] += 1
	if sum(arr) == 0:
		count += 1
	return count
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(nonzero(arr))


for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	c = 0
	for i in lst:
		if i == 0:
			lst.append(1)
			c += 1
	if sum(lst) == 0:
		c += 1
	print(c)


t = int(input())
for i in range(t):
	n = int(input())
	ni = list(map(int, input().split()))
	zC = 0
	for j in range(len(ni)):
		if ni[j] == 0:
			ni[j] = 1
			zC += 1
	if sum(ni) == 0:
		print(zC + 1)
	else:
		print(zC)


t = int(input())
for i in range(t):
	n = int(input())
	A = [int(i) for i in input().split()]
	d = A.count(0)
	s = sum(A)
	if s + d == 0:
		print(d + 1)
	else:
		print(d)


import sys
from collections import Counter
input = sys.stdin.readline

def main():
	for _ in range(int(input())):
		n = int(input())
		arr = map(int, input().split())
		ret = 0
		hap = 0
		for n in arr:
			if n == 0:
				ret += 1
			hap += n
		hap += ret
		if hap == 0:
			ret += 1
		print(ret)
main()


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	E = 0
	null = 0
	for j in range(n):
		E += a[j]
		null += int(a[j] == 0)
	if E + null == 0:
		print(null + 1)
	else:
		print(null)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	z = arr.count(0)
	print(z + (1 if sum(arr) + z == 0 else 0))


def solve():
	n = int(input())
	array = list(map(int, input().split()))
	if sum(array) != 0 and 0 not in array:
		print(0)
		return
	if sum(array) == 0 and 0 not in array:
		print(1)
		return
	if sum(array) != 0 and 0 in array:
		if array.count(0) + sum(array) != 0:
			print(array.count(0))
		else:
			print(array.count(0) + 1)
		return
	if sum(array) == 0 and 0 in array:
		print(array.count(0))
		return
T = int(input())
for _ in range(T):
	solve()


for z in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	k = a.count(0)
	c = 0
	if k == 0:
		if sum(a) == 0:
			c = 1
	else:
		for i in range(len(a)):
			if a[i] == 0:
				a[i] += 1
				c += 1
		if sum(a) == 0:
			c += 1
	print(c)


t: int = int(input())
for k in range(t):
	n: int = int(input())
	nums = list(map(lambda x: int(x), input().split(' ')))
	countZero = 0
	sumElements = 0
	countNegative = 0
	for num in nums:
		if num == 0:
			countZero += 1
		if num < 0:
			countNegative += 1
		sumElements += num
	if countZero == 0:
		if sumElements != 0:
			print(0)
		else:
			print(1)
	elif sumElements + countZero != 0:
		print(countZero)
	else:
		print(countZero + 1)


for t in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c = 0
	for i in range(n):
		if l[i] == 0:
			l[i] += 1
			c += 1
	if sum(l) == 0:
		print(c + 1)
	else:
		print(c)


a = int(input())
for i in range(a):
	b = int(input())
	ans = 0
	key = 0
	c = list(map(int, input().split()))
	for i in c:
		if i == 0:
			key += 1
			ans += 1
		else:
			ans += i
	while ans == 0:
		key += 1
		ans += 1
	print(key)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(k, p) = (sum(l), l.count(0))
	if k != 0 and p == 0:
		print(0)
	elif p == 0 and k == 0:
		print(1)
	else:
		print(p + (p + k == 0))


a = int(input())
c = 0
d = 0
k = 0
for i in range(a):
	h = int(input())
	b = input().split()
	while True:
		k = k + int(b[d])
		d += 1
		if h == d:
			break
	for o in b:
		if o in '0':
			c += 1
	if c + k == 0:
		print(c + 1)
	else:
		print(c)
	d *= 0
	c *= 0
	k *= 0


n = int(input())
i = 0
while i < n:
	num = int(input())
	lst = list(map(int, input().split()))
	isum = 0
	pr = 1
	zer = 0
	one = 0
	bz = 0
	for j in lst:
		if j >= 0:
			bz += 1
		if j == 0:
			isum += 1
			zer += 1
			continue
		isum += j
		pr *= j
		if j == -1:
			one += 1
	if zer == 0 and isum != 0:
		print(0)
		i += 1
		continue
	out = zer
	if isum == 0:
		print(out + 1)
	else:
		print(out)
	i += 1


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	suma = sum(a)
	ans = 0
	for i in range(n):
		if a[i] == 0:
			a[i] += 1
			ans += 1
	if sum(a) == 0:
		ans += 1
	print(ans)


n = int(input())
for i in range(n):
	q = int(input())
	s = list(map(int, input().split()))
	if sum(s) + s.count(0) == 0:
		print(s.count(0) + 1)
	else:
		print(s.count(0))


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	z = a.count(0)
	if z == 0:
		s = sum(a)
		if s == 0:
			print('1')
		else:
			print('0')
	else:
		for j in range(n):
			if a[j] == 0:
				a[j] += 1
		s = sum(a)
		if s == 0:
			print(z + 1)
		else:
			print(z)


t = int(input())
for i in range(t):
	n = int(input())
	num = list(map(int, input().split()))
	ans = num.count(0)
	if sum(num) + ans == 0:
		ans += 1
	print(ans)


t = int(input())
for i in range(t):
	count = 0
	n = int(input())
	l = [int(i) for i in input().split()]
	for i in range(len(l)):
		if l[i] == 0:
			l[i] += 1
			count += 1
	suml = sum(l)
	if suml == 0:
		count += 1
	print(count)


import sys
input = sys.stdin.readline
t = int(input())
for ii in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	ans = 0
	for i in range(n):
		if l[i] == 0:
			ans += 1
	if sum(l) + ans == 0:
		ans += 1
	print(ans)


t = int(input())

def product(lst):
	p = 1
	for i in lst:
		p *= i
	return p
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	inc = 0
	while 0 in arr:
		inc += 1
		arr[arr.index(0)] = 1
	if sum(arr) == 0:
		inc += 1
	print(inc)


steps = str()
for i in range(int(input())):
	input()
	a = list(map(int, input().split()))
	local_steps = len(list(filter(lambda x: x == 0, a)))
	if sum(a) + local_steps == 0:
		local_steps += 1
	steps += f'\n{local_steps}'
print(steps.strip())


t = int(input())
for i in range(t):
	n = input()
	a = [int(x) for x in input().split()]
	s = sum(a)
	c = a.count(0)
	if s + c != 0:
		print(c)
	else:
		print(c + 1)


ans = 0
cnt = 0
n = int(input())
for i in range(n):
	ans = 0
	cnt = 0
	s = int(input())
	f = list(map(int, input().split()))
	for j in range(s):
		cnt += f[j]
	for o in range(s):
		if f[o] == 0:
			cnt += 1
			ans += 1
	if cnt == 0:
		ans += 1
	print(ans)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase
from fractions import *

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	n = int(input())
	a = array()
	ans = 0
	for i in range(n):
		if a[i] == 0:
			ans += 1
			a[i] += 1
	if sum(a) == 0:
		print(ans + 1)
	else:
		print(ans)


t = int(input())
for i in range(t):
	nulls = 0
	n = int(input())
	m = map(int, input().split())
	summ = 0
	for x in m:
		if x == 0:
			nulls += 1
			summ += 1
		summ += x
	if summ == 0:
		nulls += 1
	print(nulls)


T = int(input())
for t in range(T):
	n = int(input())
	A = [int(i) for i in input().split()]
	ans = 0
	for i in range(n):
		if A[i] == 0:
			A[i] += 1
			ans += 1
	if sum(A) == 0:
		ans += 1
	print(ans)


from functools import reduce
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	p = reduce(lambda x, y: x * y, a)
	if p != 0 and sum(a) != 0:
		print(0)
	else:
		z = a.count(0)
		a = [1 if x == 0 else x for x in a]
		if sum(a) == 0:
			z = z + 1
		print(z)


x = int(input())
for i in range(x):
	y = int(input())
	l = list(map(int, input().split()))
	c = 0
	c = c + l.count(0)
	l = list(filter(lambda x: x != 0, l))
	if sum(l) + c > 0:
		print(c)
	elif sum(l) + c == 0:
		print(c + 1)
	else:
		print(c)


from collections import defaultdict
from itertools import permutations
from os import system
import sys
import queue
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	zeroCount = 0
	totSum = 0
	for i in arr:
		if i == 0:
			zeroCount += 1
		totSum += i
	mini = 0
	mini += zeroCount
	totSum += zeroCount
	if totSum != 0:
		print(mini)
	else:
		print(zeroCount + 1)


t = int(input())
for i in range(0, t):
	n = int(input())
	arr = list(map(int, input().split()))
	v = sum(arr)
	mul = 1
	z_c = 0
	for j in arr:
		if j == 0:
			z_c += 1
		mul *= j
	if mul == 0 and v == 0:
		print(z_c)
	elif mul != 0 and v == 0:
		print(1)
	elif mul == 0 and v != 0:
		if v + z_c == 0:
			print(z_c + 1)
		else:
			print(z_c)
	else:
		print(0)


from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n').split(' ')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
for _ in range(val()):
	n = val()
	l = sorted(li(), key=lambda x: abs(x))
	ans = i = 0
	while i < n:
		if l[i] == 0:
			l[i] += 1
			ans += 1
		else:
			break
		i += 1
	if sum(l) == 0:
		print(ans + 1)
	else:
		print(ans)


t = int(input())
cnt = 0
for i in range(t):
	n = int(input())
	a = [int(x) for x in input().split(' ')]
	cnt = a.count(0)
	if sum(a) + cnt == 0:
		cnt += 1
	print(cnt)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().strip().split()))
	arr = sorted(arr)
	op = 0
	zeros = 0
	neg = 0
	sm_neg = -1000000
	for i in range(n):
		if arr[i] == 0:
			arr[i] = 1
			zeros += 1
		elif arr[i] < 0:
			neg += 1
			if arr[i] > sm_neg:
				sm_neg = arr[i]
	if sum(arr) == 0:
		print(zeros + 1)
	else:
		print(zeros)


import sys
import math
import itertools
import functools
import collections
import operator

def ii():
	return int(input())

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

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

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
t = ii()
for _ in range(t):
	n = ii()
	a = li()
	b = [0] * 3
	for i in range(n):
		if a[i] > 0:
			b[1] += a[i]
		elif a[i] < 0:
			b[2] += a[i]
		else:
			b[0] += 1
	if b[0] == 0 and b[1] + b[2]:
		print(0)
	elif b[0] == 0 and b[1] + b[2] == 0:
		print(1)
	elif b[0] and b[1] + b[2] == 0:
		print(b[0])
	elif b[0] and b[1] + b[2]:
		if b[0] + b[1] == abs(b[2]):
			print(b[0] + 1)
		else:
			print(b[0])


t = int(input())
for i in range(t):
	z = 0
	p = False
	s = 0
	op = 0
	n = int(input())
	A = list(map(int, input().split()))
	for a in A:
		if a == 0:
			z = z + 1
		elif a > 0:
			p = True
		s = s + a
	if z > 0:
		s = s + z
		op = z
	if s == 0:
		if p or z > 0:
			s = s + 1
			op = op + 1
		else:
			s = s + 2
			op = op + 2
	print(op)


for _ in range(int(input())):
	length = int(input())
	arr = [int(i) for i in input().split()]
	(k, s) = (0, 0)
	k += arr.count(0)
	s = sum(arr) + arr.count(0)
	if s == 0:
		k += 1
	print(k)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	(sum, ans) = (0, 0)
	arr = list(map(int, input().split()))
	for value in arr:
		if value == 0:
			value += 1
			ans += 1
		sum += value
	if sum == 0:
		ans += 1
	print(ans)


for zz in range(int(input())):
	n = int(input())
	(sum, ans) = (0, 0)
	for i in input().split():
		sum += int(i)
		if i == '0':
			ans += 1
	sum += ans
	if sum == 0:
		print(ans + 1)
	else:
		print(ans)


n = int(input())
for i in range(n):
	n1 = int(input())
	s1 = list(map(int, input().split()))
	count = 0
	p = 1
	for i in s1:
		p *= i
	for j in range(n1):
		if s1[j] == 0:
			s1[j] += 1
			count += 1
	if sum(s1) == 0:
		for k in range(n):
			if s1[k] > 0:
				s1[k] += 1
				count += 1
				break
	print(count)


t = int(input())
for case_num in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	sum = 0
	count = 0
	for i in a:
		if i == 0:
			sum += 1
			count += 1
		else:
			sum += i
	if sum == 0:
		count += 1
	print(count)


for _ in range(int(input())):
	n = int(input())
	mas = list(map(int, input().split()))
	ans = 0
	for i in range(n):
		if mas[i] == 0:
			mas[i] = 1
			ans += 1
	if sum(mas) == 0:
		ans += 1
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	pos = 0
	neg = 0
	zero = 0
	r = 0
	l = list(map(int, input().split()))
	for x in l:
		if x > 0:
			pos += x
		elif x < 0:
			neg -= x
		else:
			zero += 1
	r += zero
	pos += r
	if pos == neg:
		r += 1
	print(r)


t = int(input())
for case in range(t):
	moves = 0
	n = int(input())
	arr = [int(x) for x in input().split()]
	for i in range(n):
		if arr[i] == 0:
			moves += 1
			arr[i] = 1
	if sum(arr) == 0:
		moves += 1
	print(moves)


def prod(array):
	product = 1
	for i in array:
		product *= i
	return product
test_case = int(input())
for _ in range(test_case):
	n = int(input())
	a = list(map(int, input().split()))
	i = 0
	while prod(a) == 0 or sum(a) == 0:
		if 0 in a:
			a[a.index(0)] += 1
		else:
			for j in range(n):
				if a[j] != -1:
					a[j] += 1
					break
		i += 1
	print(i)


a = int(input())
for i in range(a):
	x = int(input())
	z = list(map(int, input().split()))
	t = z.count(0)
	r = sum(z)
	if sum(z) == 0:
		if t == 0:
			print(1)
		else:
			print(t)
	else:
		r = r + t
		if r == 0:
			print(t + 1)
		else:
			print(t)


T = int(input())
for i in range(0, T):
	N = int(input())
	l = [int(n) for n in input().split()]
	x = l.count(0)
	if sum(l) + x != 0:
		print(x)
	else:
		print(x + 1)


for n in range(int(input())):
	x = int(input())
	s = sorted(list(map(int, input().split())))
	if sum(s) != 0 and 0 not in s:
		print(0)
		continue
	res = 0
	sm = 0
	for n in range(x):
		if s[n] == 0:
			res += 1
			s[n] = 1
	if sum(s) == 0:
		res += 1
	print(res)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a1 = a.count(0)
	sum1 = sum(a)
	if sum1 != 0 and a1 == 0:
		print(0)
	elif sum1 == 0 and a1 == 0:
		print(1)
	elif sum1 == 0 and a1 != 0:
		print(a1)
	elif sum1 != 0 and a1 != 0:
		if abs(sum1) == a1 and abs(sum1) == sum1:
			print(a1)
		elif abs(sum1) == a1 and abs(sum1) != sum1:
			print(a1 + 1)
		elif abs(sum1) > a1:
			print(a1)
		elif abs(sum1) < a1:
			print(a1)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	steps = 0
	for c in range(n):
		if arr[c] == 0:
			steps += 1
			arr[c] = 1
	add = sum(arr)
	x = 0
	if add == 0:
		add += 1
		steps += 1
	print(steps)


for tc in range(int(input())):
	n = int(input())
	a = list(map(int, input().split(' ')))
	cnt = 0
	for i in range(n):
		if a[i] == 0:
			a[i] += 1
			cnt += 1
	sm = sum(a)
	if not sm:
		print(cnt + 1)
	else:
		print(cnt)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().strip().split()))[:n]
	sm = sum(a)
	zero = a.count(0)
	if sm == 0 and zero > 0:
		print(zero)
	elif sm == 0 and zero == 0:
		print(1)
	elif sm != 0 and zero > 0:
		if sm + zero == 0:
			print(zero + 1)
		else:
			print(zero)
	else:
		print(0)


t = int(input())
for _ in range(0, t):
	k = 0
	n = int(input())
	a = list(map(int, input().split()))
	if sum(a) != 0 and a.count(0) == 0:
		print(0)
	else:
		k = k + a.count(0)
		if sum(a) + k != 0:
			print(k)
		else:
			while sum(a) + k == 0:
				k = k + 1
			print(k)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 0
	c = a.count(0)
	summ = sum(a)
	if c > 0:
		ans += c
		summ += c
	if summ == 0:
		ans += 1
	print(ans)


import sys, math
input = sys.stdin.readline

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

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

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

def invr():
	return map(int, input().split())
t = 1
t = inp()
for tt in range(t):
	n = inp()
	a = inlt()
	q = a.count(0)
	if sum(a) + q == 0:
		q = q + 1
	print(q)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
testcases = int(input())
for j in range(testcases):
	n = int(input())
	vals = list(map(int, input().split()))
	zeros = 0
	for s in range(n):
		if vals[s] == 0:
			zeros += 1
	sum1 = sum(vals)
	moves = 0
	if sum1 == 0:
		if zeros > 0:
			print(zeros)
		else:
			print(1)
	elif sum1 + zeros == 0:
		print(zeros + 1)
	else:
		print(zeros)


from sys import stdin
n = int(stdin.readline())
for _ in range(n):
	stdin.readline()
	nums = list(map(int, stdin.readline().rstrip().split(' ')))
	s = 0
	c = 0
	for num in nums:
		if num == 0:
			num += 1
			c += 1
		s += num
	if s == 0:
		c += 1
	print(c)


qq = int(input())
for _ in range(qq):
	n = int(input())
	dat = list(map(int, input().split()))
	s = sum(dat)
	zc = dat.count(0)
	res = zc
	s += zc
	if s == 0:
		res += 1
	print(res)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	p = 1
	c = 0
	for j in range(0, n):
		p = p * a[j]
		if p == 0:
			c = c + 1
			a[j] = 1
			p = 1
	s = sum(a)
	if s == 0:
		c = c + 1
	print(c)


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())

def main():
	n = inp()
	for i in range(n):
		a = inp()
		arr = inlt()
		answer = arr.count(0)
		if sum(arr) + answer == 0:
			answer += 1
		print(str(answer))
main()


t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split()))
	s = sum(a)
	cnt0 = a.count(0)
	if cnt0 != 0:
		if s + cnt0 != 0:
			print(cnt0)
		else:
			print(cnt0 + 1)
	elif s != 0:
		print('0')
	else:
		print('1')
	t = t - 1


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		iss = sum(a)
		a = [1 if i == 0 else i for i in a]
		fss = sum(a)
		if fss == 0:
			fss = 1
		print(fss - iss)
	return
main()


def main():
	n = int(input())
	arr = list(map(int, input().split()))
	cnt = arr.count(0)
	print(cnt + (1 if sum(arr) + cnt == 0 else 0))
for _ in range(int(input())):
	main()


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	sum = 0
	prod = 1
	minimum = 0
	for i in a:
		sum += i
		prod *= i
		if not i:
			minimum += 1
	sum += minimum
	if sum == 0:
		minimum += 1
	print(minimum)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	s = 0
	s += l.count(0)
	ns = sum(l) + s
	if ns == 0:
		s += 1
	print(s)


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


import sys
Input = sys.stdin.readline
n = int(input())
for _ in range(n):
	s = 0
	z = 0
	m = 0
	k = int(input())
	lst = list(map(int, input().split()))
	s = sum(lst)
	z = lst.count(0)
	m = s + z
	print(z + 1) if m == 0 else print(z)


from sys import stdin, stdout, exit as sys_ret
(f_input, f_print, f_flush) = (stdin.readline, stdout.write, stdout.flush)
for _ in range(int(f_input())):
	count = 0
	amount = int(f_input())
	numbers = [int(_) for _ in f_input().split()]
	sum_ = 0
	for i in range(amount):
		if numbers[i] == 0:
			numbers[i] = 1
			count += 1
		sum_ += numbers[i]
	f_print(str(count + 1 if sum_ == 0 else count) + '\n')


t = int(input())
for i in range(t):
	n = int(input())
	a = input().split()
	count = 0
	s = 0
	for j in range(n):
		a[j] = int(a[j])
		if a[j] == 0:
			a[j] += 1
			count += 1
		s = s + a[j]
	if s == 0:
		count += 1
	print(count)


n = int(input())
for _ in range(n):
	t = int(input())
	l = [int(x) for x in input().split()]
	a = l.count(0)
	b = sum(l)
	if b + a == 0:
		print(a + 1)
	else:
		print(a)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	result = a.count(0)
	if sum(a) + a.count(0) == 0:
		result += 1
	print(result)


t = int(input())
for i in range(t):
	int(input())
	arr = input()
	arr = arr.split()
	arr = list(map(int, arr))
	zero = arr.count(0)
	add = sum(arr)
	if zero == 0 and add != 0:
		print(0)
	elif zero == 0 and add == 0:
		print(1)
	elif zero != 0 and zero == -add:
		print(zero + 1)
	else:
		print(zero)


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	k = 0
	for j in range(len(l)):
		if l[j] == 0:
			k += 1
			l[j] += 1
	if sum(l) == 0:
		k += 1
	print(k)


import math

def change_char(s, p, r):
	return s[:p] + r + s[p + 1:]
tests = int(input())
for _ in range(tests):
	n = int(input())
	arr = list(map(int, input().split()))
	zeros = arr.count(0)
	total = sum(arr)
	total += zeros
	print(zeros if total != 0 else zeros + 1)


def main():
	import sys
	input = sys.stdin.readline
	t = int(input())
	for _ in range(t):
		N = int(input())
		A = list(map(int, input().split()))
		s = 0
		ans = 0
		for a in A:
			if a == 0:
				ans += 1
				s += 1
			else:
				s += a
		if s == 0:
			ans += 1
		print(ans)
main()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	zero = l.count(0)
	if sum(l) + zero == 0:
		print(zero + 1)
	else:
		print(zero)


for _ in range(int(input())):
	n = int(input())
	L = list(map(int, input().split()))
	c = L.count(0)
	for i in range(0, len(L)):
		if L[i] == 0:
			L[i] = 1
	if sum(L) == 0:
		print(c + 1)
	else:
		print(c)


for i in range(int(input())):
	ddd = int(input())
	r = 0
	a = [int(x) for x in input().split()]
	for i in range(ddd):
		if a[i] == 0:
			a[i] = 1
			r += 1
	if sum(a) == 0:
		r += 1
	print(r)


t = int(input())
for x in range(t):
	n = int(input())
	raw_arr = input()
	arr = raw_arr.split()
	arr = [int(i) for i in arr]
	s = sum(arr)
	p = arr[0]
	for i in range(1, len(arr)):
		p *= arr[i]
	numz = 0
	for i in arr:
		if i == 0:
			numz += 1
	if s != 0 and p != 0:
		print(0)
	elif s == 0 and p == 0:
		print(numz)
	elif s == 0 and p != 0:
		print(1)
	elif numz + s != 0:
		print(numz)
	else:
		print(numz + 1)


t = int(input())
for i in range(t):
	a = int(input())
	l = list(map(int, input().split()))
	su = 0
	c = 0
	for i in l:
		su += i
		if i == 0:
			c += 1
	ans = c
	su += c
	if su == 0:
		ans += 1
	print(ans)


def maiv(g, S):
	k = 0
	s = 0
	a = S.split()
	for i in range(len(a)):
		a[i] = int(a[i])
	for i in range(len(a)):
		a[i] = int(a[i])
	for i in range(0, len(a)):
		if a[i] == 0:
			a[i] += 1
			k += 1
	for i in range(0, len(a)):
		s += a[i]
	if s == 0:
		print(k + 1)
	else:
		print(k)
n = int(input())
for i in range(0, n):
	g = int(input())
	S = input()
	maiv(g, S)


def pro(arr):
	cnt = 0
	for i in range(len(arr)):
		if arr[i] == 0:
			arr[i] = 1
			cnt += 1
	return cnt

def summ(arr):
	summ = 0
	for i in arr:
		summ += i
	if summ == 0:
		return 1
	return 0

def non_zero(arr, idx, step):
	if len(arr) == 0:
		return 0
	step += pro(arr)
	step += summ(arr)
	return step
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = non_zero(arr, 0, 0)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if sum(a) != 0 and 0 not in a:
		print(0)
	else:
		steps = a.count(0)
		if sum(a) + steps == 0:
			steps += 1
		print(steps)


for _ in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	total = steps = 0
	for j in range(n):
		if arr[j] == 0:
			steps += 1
			total += 1
		else:
			total += arr[j]
	print(steps + 1 if total == 0 else steps)


for jk in range(int(input())):
	q = input()
	numArray = [int(x) for x in input().split()]
	sumArray = sum(numArray)
	steps = numArray.count(0)
	sumArray += steps
	if sumArray == 0:
		steps += 1
	print(steps)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	cnt = 0
	res = 0
	for j in a:
		if j == 0:
			cnt += 1
			j = 1
		res = res + j
	if res == 0:
		cnt += 1
	print(cnt)


test = int(input())
for _ in range(test):
	a = int(input())
	LIST = list(map(int, input().split()))
	(a1, a2) = (0, 0)
	z1 = 0
	for i in LIST:
		if i < 0:
			a1 += i
		elif i > 0:
			a2 += i
		else:
			z1 += 1
	RESULT = z1
	a2 = a2 + z1
	if a2 + a1 == 0:
		RESULT += 1
	print(RESULT)


def Input():
	tem = input().split()
	ans = []
	for it in tem:
		ans.append(int(it))
	return ans
T = Input()[0]
for t in range(T):
	n = Input()[0]
	a = Input()
	zero = 0
	total = 0
	for i in range(n):
		if a[i] == 0:
			zero += 1
		total += a[i]
	if zero == 0:
		if total == 0:
			print(1)
		else:
			print(0)
	elif total + zero == 0:
		print(zero + 1)
	else:
		print(zero)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	s = sum(l)
	y = l.count(0)
	res = y
	if s + y == 0:
		res = res + 1
	print(res)


for t in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	z = 0
	s = 0
	for i in range(n):
		z += int(arr[i] == 0)
		s += arr[i]
	s += z
	if s == 0:
		print(z + 1)
	else:
		print(z)


from sys import stdin

def inp():
	return (ss.rstrip() for ss in stdin).__next__()

def itg():
	return int(inp())

def mpint():
	return map(int, inp().split())
for case in range(itg()):
	n = itg()
	arr = tuple(mpint())
	zero = arr.count(0)
	s = sum(arr)
	ans = zero
	s += zero
	if s == 0:
		ans += 1
	print(ans)


def solve(n, a_s):
	ans = 0
	sum_a = 0
	for (i, a) in enumerate(a_s):
		if a == 0:
			a += 1
			ans += 1
		sum_a += a
	if sum_a == 0:
		ans += 1
	return ans
t = int(input())
for _ in range(t):
	n = int(input())
	a_s = [int(ch) for ch in input().split(' ')]
	print(solve(n, a_s))


t = int(input())
for test in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = 0
	for i in range(n):
		if arr[i] == 0:
			arr[i] = arr[i] + 1
			ans = ans + 1
	arr.sort()
	sum_arr = sum(arr)
	if sum_arr != 0:
		print(ans)
	else:
		print(ans + 1)


for adsf in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	count = 0
	for i in range(n):
		if a[i] == 0:
			count += 1
			a[i] = 1
	if sum(a) == 0:
		count += 1
	print(count)


t = int(input())
for _ in range(t):
	a = int(input())
	b = list(map(int, input().split()))
	c = []
	k = int(0)
	for x in b:
		if x == 0:
			c.append(1)
			k = k + 1
		else:
			c.append(x)
	if sum(c) == 0:
		print(k + 1)
	else:
		print(k)


import sys
import math
from collections import defaultdict, Counter
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	c = a.count(0)
	ans = c
	if sum(a) + c == 0:
		ans += 1
	print(ans)


t = int(input())
for ti in range(t):
	n = int(input())
	li = [int(i) for i in input().split(' ')]
	tot = 0
	ans = 0
	for i in li:
		tot += i
		if i == 0:
			ans += 1
			tot += 1
	if tot == 0:
		ans += 1
	print(ans)


from collections import Counter
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce

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

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
for _ in range(iinput()):
	n = iinput()
	a = rlinput()
	z = 0
	s = sum(a)
	z = a.count(0)
	if s == 0 and z > 0:
		print(z)
	elif s == 0:
		print(1)
	elif z > 0:
		print(z if z + s != 0 else z + 1)
	else:
		print(0)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	x = arr.count(0)
	y = sum(arr)
	if y == -x:
		print(x + 1)
	else:
		print(x)


def non_zero(numbers):
	zeros_count = 0
	for number in numbers:
		if number == 0:
			zeros_count += 1
	if sum(numbers) + zeros_count != 0:
		return zeros_count
	else:
		return zeros_count + 1
for _ in range(int(input())):
	n = int(input())
	numbers = list(map(int, input().split()))
	print(non_zero(numbers))


from sys import stdin
r = stdin.readline

def read_list():
	return list(map(int, r().strip().split()))

def prod(A):
	ans = 1
	for x in A:
		ans *= x
	return ans

def solve(A):
	ans = 0
	if prod(A) != 0 and sum(A) != 0:
		ans = 0
	else:
		for i in range(len(A)):
			if A[i] == 0:
				A[i] += 1
				ans += 1
		if sum(A) == 0:
			ans += 1
	return ans

def main():
	cases = int(r())
	for case in range(cases):
		n = int(r())
		A = read_list()
		print(solve(A))
main()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	cnt = 0
	for i in range(len(l)):
		if l[i] == 0:
			cnt = cnt + 1
			l[i] = 1
	if sum(l) == 0:
		cnt = cnt + 1
	print(cnt)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	s = 0
	m = 1
	c = 0
	for i in l:
		s += i
		m *= i
	if s != 0 and m != 0:
		c = 0
	if s == 0 and m != 0:
		c += 1
	if m == 0 and s != 0:
		k = l.count(0)
		c += k
		if s + c == 0:
			c += 1
	if s == 0 and m == 0:
		k = l.count(0)
		c += k
		if s + c == 0:
			c += 1
	print(c)


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	zero = a.count(0)
	s = 1 if sum(a) + zero == 0 else 0
	print(zero + s)


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	l1 = []
	c = 0
	for i in l:
		if i == 0:
			l1.append(1)
			c += 1
		else:
			l1.append(i)
	x = sum(l1)
	if x == 0:
		print(c + 1)
	else:
		print(c)


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	count = 0
	for i in a:
		if i is 0:
			count += 1
	if sum(a) is not 0 and count is 0:
		print(0)
	else:
		ans = max(1, count)
		if sum(a) is -1 * ans:
			ans += 1
		print(ans)


from sys import stdin, stdout

def main():
	T = int(stdin.readline())
	for _ in range(T):
		n = int(stdin.readline())
		arr = list(map(int, stdin.readline().split()))
		count = 0
		sum = 0
		minus_count = 0
		for x in arr:
			if x == 0:
				count += 1
			elif x == -1:
				minus_count += 1
			sum += x
		if sum + count == 0:
			count += 1
		stdout.write(str(count) + '\n')
main()


for i in range(int(input())):
	input()
	a = tuple(map(int, input().split()))
	c = a.count(0)
	print(c + (sum(a) + c == 0))


t = int(input())
while int(t) > 0:
	n = int(input())
	q = input()
	a = q.split()
	s = 0
	for i in range(0, n):
		a[i] = int(a[i])
		s += a[i]
	z = a.count(0)
	if s == -1 * z or (z == 0 and s == 0):
		print(z + 1)
	else:
		print(z)
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(j) for j in input().split()]
	z = arr.count(0)
	su = sum(arr) + z
	if su == 0:
		z += 1
	print(z)


def nzo(l):
	c = l.count(0)
	if c > 0:
		if sum(l) + c == 0:
			print(c + 1)
		else:
			print(c)
		return
	else:
		if sum(l) == 0:
			print(1)
		else:
			print(0)
		return
n = int(input())
for i in range(n):
	a = int(input())
	t = input()
	l = list(map(int, t.split(' ')))
	nzo(l)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	res = 0
	for i in range(n):
		if a[i] == 0:
			a[i] = 1
			res += 1
	if sum(a) == 0:
		res += 1
	print(res)


N = int(input())
nu = []
for i in range(N):
	n = int(input())
	a = list(map(int, input().split()))
	num = 0
	for j in a:
		if j == 0:
			num += 1
	if sum(a) + num == 0:
		num += 1
	nu.append(num)
for k in nu:
	print(k)


from sys import stdin, stdout
insize = int(stdin.readline().replace('\n', ''))
asize = []
a1 = []
for x in range(insize):
	asize = stdin.readline().replace('\n', '')
	a1.append(stdin.readline().replace('\n', '').split(' '))
for item in a1:
	for x in range(len(item)):
		test = item[x]
		item[x] = int(test)
for item in a1:
	ans = 0
	for i in item:
		if i == 0:
			item[item.index(i)] += 1
			ans += 1
	if sum(item) == 0:
		ans += 1
	print(ans)


n = int(input())
for _ in range(n):
	t = int(input())
	a = list(map(int, input().split()))
	max_a = max(a)
	sum_a = sum(a)
	zero_count = a.count(0)
	sum_a += zero_count
	if sum_a == 0:
		zero_count += 1
	print(zero_count)


k = int(input())
for i in range(k):
	summa = 0
	n = int(input())
	a = list(map(int, input().split()))
	for i in range(len(a)):
		if a[i] == 0:
			summa += 1
			a[i] = 1
	if sum(a) == 0:
		print(summa + 1)
	else:
		print(summa)


for t in range(int(input())):
	k = int(input())
	c = 0
	s = 0
	m = [int(x) for x in input().split()]
	for i in m:
		if i == 0:
			c += 1
			s += 1
		else:
			s += i
	if s == 0:
		c += 1
	print(c)


for i in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	ans = 0
	summ = 0
	for i in range(len(s)):
		if s[i] == 0:
			ans += 1
			summ += 1
		else:
			summ += s[i]
	if summ == 0:
		ans += 1
	print(ans)


def main():
	n = int(input())
	a = [int(s) for s in input().split()]
	count = 0
	for i in range(n):
		if a[i] == 0:
			a[i] += 1
			count += 1
	if sum(a) == 0:
		return count + 1
	else:
		return count
t = int(input())
for i in range(t):
	print(main())


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
import bisect
from heapq import *
from math import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def bs(a, l, h, x):
	while l < h:
		mid = (l + h) // 2
		if a[mid] == x:
			return mid
		if a[mid] < x:
			l = mid + 1
		else:
			h = mid
	return l

def sieve(a):
	for i in range(3, 10 ** 6 + 1, 2):
		a[i] = 1
	for i in range(3, 10 ** 6 + 1, 2):
		for j in range(i * i, 10 ** 6 + 1, i):
			a[j] = 0
	a[2] = 1
	return a

def solve():
	n = int(inp())
	a = lis()
	ans = a.count(0)
	s = sum(a) + ans
	if s == 0:
		ans += 1
	print(ans)
testcase(int(inp()))


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = ip()
for _ in range(t):
	n = ip()
	arr = list(inp())
	ans = 0
	for i in range(n):
		if arr[i] == 0:
			arr[i] += 1
			ans += 1
	if sum(arr) == 0:
		arr[0] += 1
		ans += 1
	out(ans)


T = int(input())
for k in range(T):
	n = int(input())
	arr = list(map(int, input().split()))
	if sum(arr) > 0:
		print(arr.count(0))
	elif sum(arr) == 0:
		if arr.count(0) == 0:
			print(1)
		else:
			print(arr.count(0))
	elif sum(arr) + arr.count(0) == 0:
		print(arr.count(0) + 1)
	else:
		print(arr.count(0))


t = int(input())
for i in range(t):
	n = int(input())
	count = 0
	lst = list(map(int, input().split()))
	if 0 in lst:
		count = lst.count(0)
		for x in range(len(lst)):
			if lst[x] == 0:
				lst[x] = 1
	if sum(lst) == 0:
		count += 1
	print(count)


t = int(input())
for x in range(t):
	sum = 0
	s = 0
	n = int(input())
	a = []
	a.clear()
	a = input().split()
	for x in a:
		x = int(x)
		if x == 0:
			x += 1
			s += 1
		sum += x
	if sum == 0:
		sum += 1
		s += 1
	print(s)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().strip().split(' ')))
	c = 0
	for j in range(n):
		if a[j] == 0:
			a[j] = 1
			c += 1
	x = sum(a)
	if x == 0:
		c += 1
	print(c)


t = int(input())
for i in range(t):
	n = int(input())
	L = list(map(int, input().split()))
	flag = True
	c = 0
	s1 = 0
	while flag:
		s = s1
		p = 1
		for k in L:
			s += k
			p *= k
		if p != 0 and s != 0:
			flag = False
		if p == 0 and s != 0 or (p == 0 and s == 0):
			for j in range(len(L)):
				if L[j] == 0:
					c += 1
					L[j] += 1
		if p != 0 and s == 0:
			s1 += 1
			c += 1
	print(c)


import sys

def rr():
	return sys.stdin.readline().rstrip()
rp = print

def print(*args, **kwargs):
	rp('DBG:# ', *args, **kwargs, file=sys.stderr)

def rri():
	return int(rr())

def rrl():
	return list(map(int, rr().split()))

def rrt():
	return tuple(map(int, rr().split()))

def rrle():
	return (line.rstrip() for line in sys.stdin.readlines())

def rrtl():
	return [tuple(map(int, l.split())) for l in rrle()]
from collections import defaultdict

def mus(d=lambda : 0):
	return defaultdict(lambda : defaultdict(d))

def dd0(d=lambda : 0):
	return defaultdict(d)

def ms(x, y, d=0):
	return [[0] * y for i in range(x)]

def ar(x, d=0):
	return [d] * x

def ppm(m, n=0, x=0, y=0):
	print('\n'.join(('\t'.join((str(m[j][i]) for j in range(y or n))) for i in range(x or n))))

def ppa(a, n):
	print('\t'.join(map(str, a[0:n])))

def ppl(a=0, x=[1]):
	x[0] = a or x[0] + 1
	print('-' + '- -' * 14 + '-# ' + str(x[0] - 2) + ' #-' + '- -' * 14 + '-')

def fltn(a):
	(i for sub in a for i in sub)

def yn(x):
	return 'YES' if x else 'NO'

def cpc(arr):
	return zip(arr, arr[1:])
from itertools import accumulate
from itertools import groupby
from itertools import permutations

def grp(x, key=None):
	return ((i, sum((1 for _ in g))) for (i, g) in groupby(x, key=key))
import math

def rnar():
	return (*rrl(), rrl())

def rn():
	return (*rrl(),)

def dpp(a, b=''):
	print('#| {} |#:^ {} ^:'.format(a, b))

def str_join(i, sep=' '):
	return sep.join(map(str, i))
MOD17 = 10 ** 9 + 7

def read():
	return rnar()
	return (*rrl(),)

def solve(n, arr):
	z = arr.count(0)
	z += sum(arr) + z == 0
	ans = z
	return ans
test_count = rri()
for _ in range(test_count):
	input_data = read()
	result = solve(*input_data)
	rp(result)


for i in range(int(input())):
	n = int(input())
	list1 = []
	x = 0
	for i in [int(x) for x in input().split(' ')]:
		list1.append(i)
	for i in range(0, n):
		if list1[i] == 0:
			list1[i] += 1
			x += 1
	y = 0
	for i in range(0, n):
		y = y + list1[i]
	if y == 0:
		for i in range(0, n):
			if list1[i] != -1:
				list1[i] += 1
				x += 1
				break
	print(x)


t = int(input())

def f(l):
	kol = 0
	sum = 0
	ans = 0
	for i in l:
		if int(i) == 0:
			kol += 1
		sum += int(i)
	if kol:
		sum += kol
		if sum == 0:
			ans += kol + 1
		else:
			ans += kol
	elif sum == 0:
		ans += 1
	return ans
for i in range(t):
	n = input()
	l = input()
	l = l.split()
	print(f(l))


t = int(input())
for i in range(t):
	n = int(input())
	mas = [int(i) for i in input().split()]
	if 0 in mas:
		count = 0
		while 0 in mas:
			mas[mas.index(0)] = 1
			count += 1
		if sum(mas) == 0:
			print(count + 1)
		else:
			print(count)
	elif 0 not in mas:
		if sum(mas) == 0:
			if mas.count(-1) == n:
				print(2)
			else:
				print(1)
		else:
			print(0)


for _ in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	if sum(A) != 0 and A.count(0) == 0:
		print(0)
		continue
	if A.count(0) != 0:
		if A.count(0) + sum(A) == 0:
			print(A.count(0) + 1)
			continue
		else:
			print(A.count(0))
			continue
	if sum(A) == 0:
		print(1)
		continue


tests = int(input())
for test in range(tests):
	n = int(input())
	a = [int(x) for x in input().split()]
	steps_count = 0
	zero_count = a.count(0)
	a = [1 if x == 0 else x for x in a]
	steps_count += zero_count
	while sum(a) == 0:
		a[0] += 1
		steps_count += 1
	print(steps_count)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ans = 0
	for t in range(n):
		if l[t] == 0:
			ans += 1
			l[t] += 1
	s = sum(l)
	print(ans if s != 0 else ans + 1)


def multiply(arr):
	ans = 1
	for i in arr:
		ans *= i
	return ans

def solve(arr):
	cnt = 0
	if multiply(arr) != 0 and sum(arr) != 0:
		return cnt
	else:
		while True:
			if 0 in arr:
				cnt += arr.count(0)
				for i in range(arr.count(0)):
					arr[arr.index(0)] += 1
			if sum(arr) != 0:
				return cnt
			try:
				for i in range(len(arr)):
					if arr[i] > 0:
						arr[i] += 1
						break
			except IndexError:
				arr[0] += 1
			cnt += 1
for _ in range(int(input())):
	input()
	arr = list(map(int, input().split()))
	print(solve(arr))


import math

def solve():
	n = int(input())
	table = list(map(int, input().split()))
	(sum, re) = (0, 0)
	for i in range(n):
		if table[i] == 0:
			table[i] += 1
			re += 1
		sum += table[i]
	if sum == 0:
		re += 1
	print(re)

def main():
	T = 1
	T = int(input())
	while T:
		solve()
		T -= 1
main()


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	zeros = arr.count(0)
	total = sum(arr)
	ans = zeros
	if total + zeros == 0:
		ans += 1
	print(ans)


def solve(A, N):
	steps = 0
	for i in range(N):
		if A[i] == 0:
			steps += 1
			A[i] = 1
	if sum(A) == 0:
		assert set(A) != {-1}
		steps += 1
	return steps
(T,) = map(int, input().split())
for t in range(T):
	(N,) = map(int, input().split())
	A = list(map(int, input().split()))
	assert len(A) == N
	ans = solve(A, N)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	cntzer = 0
	for val in arr:
		if val == 0:
			cntzer += 1
	bal = sum(arr)
	if bal + cntzer == 0:
		print(cntzer + 1)
	else:
		print(cntzer)


n = int(input())
d = 0
for i in range(n):
	k = int(input())
	x = list(map(int, input().split()))
	for l in range(k):
		if x[l] == 0:
			d += 1
			x[l] += 1
	if sum(x) == 0:
		d += 1
	print(d)
	d = 0
	x.clear()


in1 = int(input())
for i in range(in1):
	in2 = int(input())
	in3 = input().split()
	in3 = list(map(int, in3))
	k = 0
	s = 0
	for j in range(in2):
		if in3[j] == 0:
			s = s + 1
			k = k + 1
		else:
			s = s + in3[j]
	if s == 0:
		k = k + 1
	print(k)


from sys import *
from bisect import bisect_left as bl, bisect_right as br, bisect
from math import *
from time import clock as cl
from itertools import zip_longest as zl
from itertools import groupby as gb
from itertools import combinations as comb
from itertools import combinations_with_replacement as cwr
from collections import defaultdict as dd
from collections import deque as dq
from collections import Counter as c
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return input()

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [[val for i in range(n)] for j in range(m)]
for _ in range(int(input())):
	n = int(data())
	arr = l()
	s = sum(arr)
	neg = 0
	ans = 0
	for i in range(n):
		if i < 0:
			neg += i
	pos = s + neg
	for i in range(n):
		if arr[i] == 0:
			ans += 1
			pos += 1
	if pos == neg:
		print(ans + 1)
	else:
		print(ans)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	x = 0
	if 0 in a:
		x = a.count(0)
		a.remove(0)
	a.append(x)
	s = sum(a)
	flag = 0
	for j in range(n):
		if s != 0:
			print(x)
			break
		elif a[j] != -1:
			a[j] += 1
			print(x + 1)
			flag = 1
			break
		if flag == 1:
			break


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	p = sum(l)
	k = l.count(0)
	p += k
	if p == 0:
		k += 1
	print(k)


T = int(input())
for _ in range(T):
	n = int(input())
	xs = list(map(int, input().split()))
	print(sum((x == 0 for x in xs)) + int(sum((1 if x == 0 else x for x in xs)) == 0))


n = int(input())
for _ in range(n):
	num = int(input())
	a = list(map(int, input().split()))
	ans = 0
	zero = a.count(0)
	s = sum(a) + zero
	if s == 0:
		ans += 1
	print(ans + zero)


num_cases = int(input())
for i in range(num_cases):
	num_elements = int(input())
	array = [int(n) for n in input().split()]
	count = 0
	for j in range(num_elements):
		if array[j] == 0:
			array[j] += 1
			count += 1
	if sum(array) == 0:
		array[j] += 1
		count += 1
	print(count)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	sm = sum(a)
	fs = 0
	fm = 0
	if sm == 0:
		fs = 1
	for x in a:
		if x == 0:
			fm += 1
	if fs == 0 and fm == 0:
		print(0)
	elif fs == 0:
		if fm + sum(a) == 0:
			print(fm + 1)
		else:
			print(fm)
	elif fm == 0:
		if sum(a) == 0:
			print(1)
		else:
			print(0)
	else:
		print(fm)


t = int(input())
for k in range(t):
	n = int(input())
	a = input().split()
	x = 0
	s = 0
	for i in range(n):
		if a[i] == '0':
			s = s + int(a[i]) + 1
			x = x + 1
		else:
			s = s + int(a[i])
	if s == 0:
		x = x + 1
	print(x)


import sys, itertools, math
T = int(sys.stdin.readline())
for _ in range(T):
	sys.stdin.readline()
	A = [int(i) for i in sys.stdin.readline().strip().split(' ')]
	s = 0
	z = 0
	for a in A:
		s += a
		if a == 0:
			z += 1
	ans = 0
	ans += z
	s += z
	if s == 0:
		ans += 1
	print(ans)


def q1300a():
	n = int(input())
	for _ in range(n):
		arr_len = int(input())
		arr = [int(num) for num in input().split()]
		subproblem(arr_len, arr)

def subproblem(arr_len, arr):
	zero_count = 0
	for i in range(len(arr)):
		if arr[i] == 0:
			zero_count += 1
			arr[i] = 1
	if sum(arr) == 0:
		zero_count += 1
	print(zero_count)
q1300a()


def solve(a):
	count_of_zeroes = len(list(filter(lambda x: x == 0, a)))
	if count_of_zeroes > 0:
		if sum(a) + count_of_zeroes == 0:
			return count_of_zeroes + 1
		else:
			return count_of_zeroes
	if sum(a) == 0:
		return 1
	return 0
for i in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	print(solve(a))


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	s = 0
	cnt = 0
	for x in range(n):
		if l[x] == 0:
			l[x] = 1
			cnt += 1
		s += l[x]
	if s != 0:
		print(cnt)
	else:
		print(cnt + 1)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	zero = 0
	sum1 = 0
	for i in arr:
		if i == 0:
			zero += 1
		sum1 += i
	count = zero
	sum1 += zero
	if sum1 == 0:
		count += 1
	print(count)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	res = 0
	if sum(a) != 0 and 0 not in a:
		print(0)
		continue
	else:
		while 0 in a:
			for _ in range(n):
				if a[_] == 0:
					a[_] += 1
					res += 1
		if sum(a) == 0:
			a[0] += 1
			res += 1
		print(res)


for t in range(int(input())):
	n = int(input())
	d = 0
	g = 0
	a = [int(u) for u in input().split()]
	for j in a:
		if j == 0:
			d += 1
			g += 1
		else:
			g += j
	if g == 0:
		d += 1
	print(d)


I = input
for _ in [0] * int(I()):
	I()
	a = (*map(int, I().split()),)
	r = a.count(0)
	print(r + (sum(a) + r == 0))


q = int(input())
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	sum_x = 0
	zero = 0
	for j in range(n):
		sum_x += a[j]
		if a[j] == 0:
			zero += 1
	if zero == 0 and sum_x != 0:
		print(0)
	elif sum_x == 0 and zero == 0:
		flag = False
		for k in range(n):
			if a[k] != -1:
				flag = True
		if flag:
			print(1)
		else:
			print(2)
	elif sum_x == 0 and zero != 0:
		print(zero)
	elif sum_x != 0 and zero != 0:
		if -1 * zero == sum_x:
			print(zero + 1)
		else:
			print(zero)


T = int(input())
for i in range(T):
	n = int(input())
	ai = list(map(int, input().split()))
	print(ai.count(0) + 1 if sum(ai) + ai.count(0) == 0 else ai.count(0))


t = int(input())
while t > 0:
	n = int(input())
	arr = list(map(int, input().split()))
	sum = 0
	ans = 0
	for i in range(n):
		if arr[i] == 0:
			sum += 1
			ans += 1
		else:
			sum += arr[i]
	if sum == 0:
		ans += 1
	print(ans)
	t = t - 1


n = int(input())
for t__ in range(n):
	a = int(input())
	q = list(map(int, input().split()))
	k = 0
	if sum(q) == 0:
		if 0 in q:
			for i in range(a):
				if q[i] == 0:
					k += 1
			print(k)
		else:
			print(1)
	else:
		k = 0
		if 0 in q:
			for i in range(a):
				if q[i] == 0:
					k += 1
					q[i] += 1
			if sum(q) == 0:
				print(k + 1)
			else:
				print(k)
		else:
			print(0)


for i in range(int(input())):
	a = 0
	z = input()
	x = [int(i) for i in input().split()]
	a += x.count(0)
	print(['%d' % a, '%d' % (a + 1)][sum(x) + 1 * a == 0])


t = int(input())
inputs = [[]] * t
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	inputs[i] = [n, a]
for (n, a) in inputs:
	s = sum(a)
	zero_count = sum(map(lambda x: int(x == 0), a))
	ans = zero_count
	s += zero_count
	if s == 0:
		ans += 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l1 = list(map(int, input().split()))
	moves = 0
	x = 0
	for i in range(n):
		if l1[i] == 0:
			l1[i] = 1
			moves += 1
		x = x + l1[i]
	if x != 0:
		print(moves)
	else:
		print(moves + 1)


no = int(input())
res = []
for i in range(no):
	n = int(input())
	test = list(map(int, input().split()))
	count_z = 0
	count_sum = 0
	for i in test:
		if i == 0:
			count_z += 1
	if sum(test) + count_z == 0:
		count_sum += 1
	res.append(count_sum + count_z)
for i in res:
	print(i)


for t in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	zero = sum([1 for i in a if i == 0])
	if sum(a) + zero == 0:
		zero += 1
	print(zero)


kl = int(input())
for l in range(kl):
	n = int(input())
	s = 0
	k = 0
	for i in input().split():
		i = int(i)
		if i == 0:
			k += 1
			s += 1
		else:
			s += i
	if s == 0:
		print(k + 1)
	else:
		print(k)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	lst = list(map(int, input().split()))
	ans = 0
	for i in lst:
		if i == 0:
			ans += 1
	s = sum(lst)
	s = s + ans
	if s == 0:
		ans += 1
	print(ans)


def prod(arr):
	p = 1
	for i in arr:
		p *= i
	return p

def nonZero(arr):
	c = 0
	if sum(arr) != 0 and prod(arr) != 0:
		return 0
	else:
		for i in range(arr.count(0)):
			arr[arr.index(0)] = 1
			c += 1
		if sum(arr) == 0:
			arr[1] += 1
			c += 1
		return c
tc = int(input())
for i in range(tc):
	n = int(input())
	arr = list(map(int, input().split()))
	print(nonZero(arr))


t = int(input())
for q in range(t):
	n = int(input())
	nums = [int(x) for x in input().split()]
	count = 0
	sum = 0
	for x in nums:
		if x == 0:
			count += 1
			sum += 1
		sum += x
	if sum == 0:
		count += 1
	print(count)


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	cur = sum(a)
	z = 0
	o = 0
	for i in a:
		if i == 0:
			z += 1
		elif i == -1:
			o += 1
	cur += z
	if cur == 0:
		if o == n:
			print(2)
		else:
			print(z + 1)
	else:
		print(z)


import sys
input = sys.stdin.readline
(K,) = map(int, input().split())
for _ in range(K):
	(N,) = map(int, input().split())
	xs = list(map(int, input().split()))
	r = xs.count(0)
	if r + sum(xs) == 0:
		r += 1
	print(r)


from sys import stdin, stdout
x = [line.rstrip() for line in stdin]
del x[0]
for i in x[1::2]:
	i = list(map(int, i.split()))
	zeros = 0
	sum = 0
	for num in i:
		if num == 0:
			zeros += 1
		else:
			sum += num
	sum += zeros
	if sum == 0:
		print(zeros + 1)
	else:
		print(zeros)


for _ in range(int(input())):
	n = int(input())
	w = [int(i) for i in input().split()]
	a = w.count(0)
	b = sum(w)
	if b != 0 and a == 0:
		print(0)
	elif a + b == 0:
		print(a + 1)
	else:
		print(a)


try:
	for _ in range(int(input())):
		n = int(input())
		l = list(map(int, input().split()))
		c = l.count(0)
		d = c + sum(l)
		if d == 0:
			print(c + 1)
		else:
			print(c)
except:
	pass


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	q = a.count(0)
	if q + sum(a) == 0:
		print(q + 1)
	else:
		print(q)


for j in range(int(input())):
	n = int(input())
	flag = 0
	sum = 0
	l1 = list(map(int, input().split()))
	for i in range(0, n):
		if l1[i] == 0:
			l1[i] += 1
			flag += 1
		sum += l1[i]
	if sum == 0:
		flag += 1
	print(flag)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c = s = 0
	for i in range(n):
		if l[i] == 0:
			c += 1
		s += l[i]
	s += c
	if s == 0:
		c += 1
	print(c)


m = int(input())
for i in range(0, m):
	n = int(input())
	a = list(map(int, input().split()))
	if 0 in a:
		c = a.count(0)
		if c + sum(a) == 0:
			ans = c + 1
		else:
			ans = c
	elif sum(a) == 0:
		ans = 1
	else:
		ans = 0
	print(ans)


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


def iinput():
	return [int(x) for x in input().split()]

def main():
	n = int(input())
	data = iinput()
	s = 0
	count = 0
	for i in range(n):
		if data[i] == 0:
			count += 1
		s += data[i]
	if -s != count:
		return count
	return count + 1
for t in range(int(input())):
	print(main())


t = int(input())
for _ in range(t):
	n = int(input())
	al = list(map(int, input().split()))
	ss = sum(al)
	cz = sum([al[i] == 0 for i in range(n)])
	print(cz if ss != -cz else cz + 1)


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	l = input().split(' ')
	for i in range(len(l)):
		l[i] = int(l[i])
	s = sum(l)
	p = 1
	for i in range(len(l)):
		p = p * l[i]
	if s > 0 and p > 0:
		print(0)
	else:
		count = 0
		for i in range(len(l)):
			if l[i] == 0:
				count += 1
				l[i] = 1
		if sum(l) != 0:
			print(count)
		else:
			print(count + 1)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	c = 0
	for i in range(n):
		num = arr[i]
		if num == 0:
			arr[i] = 1
			c += 1
	if sum(arr) == 0:
		print(c + 1)
	else:
		print(c)


n = int(input())
for i in range(n):
	s = int(input())
	l = list(map(int, input().split()))
	a = 0
	i = 0
	while i < s:
		if l[i] == 0:
			l[i] = 1
			a = a + 1
		i = i + 1
	if sum(l) == 0:
		print(a + 1)
	else:
		print(a)


t = int(input())
for i in range(t):
	s = int(input())
	arr = [int(x) for x in input().split()]
	count = 0
	m = 1
	sum1 = sum(arr)
	for i in range(s):
		if arr[i] == 0:
			count += 1
	if count == 0:
		if sum1 == 0:
			print(1)
		else:
			print(0)
	else:
		sum1 = sum1 + count
		if sum1 == 0:
			print(count + 1)
		else:
			print(count)


for _ in range(int(input())):
	n = int(input())
	arr = [int(g) for g in input().split(' ')]
	summ = 0
	count = 0
	for j in range(len(arr)):
		if arr[j] == 0:
			count = count + 1
			arr[j] = 1
		summ = summ + arr[j]
	if summ == 0:
		count = count + 1
	print(count)


from functools import reduce
for i in range(int(input())):
	num = 0
	n = int(input())
	a = list(map(int, input().split()))
	if reduce(lambda x, y: x * y, a) == 0:
		for i in range(n):
			if a[i] == 0:
				a[i] += 1
				num += 1
		if sum(a) == 0:
			num += 1
	elif sum(a) == 0:
		num += 1
	print(num)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	k = a.count(0)
	s = sum(a)
	if k == 0 and s != 0:
		print(0)
	elif k == 0 and s == 0:
		print(1)
	else:
		s += k
		if s == 0:
			print(k + 1)
		else:
			print(k)


for _ in range(int(input())):
	n = int(input())
	l = input().split(' ')
	result = 1
	for i in range(0, n):
		l[i] = int(l[i])
	Sum = sum(l)
	zero = l.count(0)
	if zero == -1 * Sum:
		print(zero + 1)
	elif Sum == 0 and zero == 0:
		print(1)
	else:
		print(zero)


import math
for _ in range(int(input())):
	R = input()
	n = list(map(int, input().split()))
	c = 0
	s = 0
	for i in n:
		if i == 0:
			c += 1
		s = s + i
	s += c
	if s == 0:
		c += 1
	print(c)


for i in range(int(input())):
	x = input()
	z = list(map(int, input().split()))
	counter = 0
	for j in z:
		if j == 0:
			counter += 1
	print(counter if sum(z) + counter != 0 else counter + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	z = 0
	s = sum(a)
	for num in a:
		if num == 0:
			z += 1
	if s + z == 0:
		print(z + 1)
	else:
		print(z)


def sum(arr):
	ret = 0
	for el in arr:
		ret += el
	return ret

def product(arr):
	ret = 1
	for el in arr:
		ret *= el
	return ret

def func(arr):
	count = 0
	for i in range(len(arr)):
		if arr[i] == 0:
			arr[i] += 1
			count += 1
	if sum(arr) != 0:
		return count
	else:
		return count + 1
t = int(input())
arrs = []
for i in range(t):
	arr_size = int(input())
	tmp_arr = []
	s = input()
	s = s.split()
	for el in s:
		tmp_arr.append(int(el))
	arrs.append(tmp_arr)
for i in range(t):
	print(func(arrs[i]))


t = int(input())
while t:
	t = t - 1
	n = int(input())
	a_i = [int(x) for x in input().split()]
	min = 0
	if a_i.count(0) == 0 and sum(a_i) != 0:
		pass
	else:
		min = a_i.count(0)
		if sum(a_i) + a_i.count(0) == 0:
			min = min + 1
	print(min)


n = int(input())
k = 0
z = 0
m = 0
lst = []
for i in range(n):
	k = 0
	z = 0
	n1 = int(input())
	n2 = list(map(int, input().split()[:n1]))
	m = 0
	for j in range(n1):
		if n2.count(0) == 0:
			s = sum(n2) + m
			if s == 0:
				m = m + 1
				k = k + 1
			else:
				break
		else:
			for i in n2:
				if i == 0:
					n2.remove(i)
					n2.append(1)
					z = z + 1
	lst.append(k + z)
for g in lst:
	print(g)


import sys
import math
from collections import defaultdict
from collections import deque
from itertools import combinations
from itertools import permutations
input = lambda : sys.stdin.readline().rstrip()
read = lambda : list(map(int, input().split()))
go = lambda : 1 / 0

def write(*args, sep='\n'):
	for i in args:
		sys.stdout.write('{}{}'.format(i, sep))
INF = float('inf')
MOD = int(1000000000.0 + 7)
YES = 'YES'
NO = 'NO'
for _ in range(int(input())):
	try:
		n = int(input())
		arr = read()
		ans = 0
		for i in range(n):
			if arr[i] == 0:
				arr[i] = 1
				ans += 1
		if sum(arr) == 0:
			print(ans + 1)
		else:
			print(ans)
	except ZeroDivisionError:
		continue
	except Exception as e:
		print(e)
		continue


import math
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = sum(a)
	if 0 not in a and s != 0:
		print(0)
	elif 0 not in a and s == 0:
		print(1)
	else:
		k = a.count(0)
		if k == -1 * s:
			print(k + 1)
		else:
			print(k)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	s = sum(arr)
	z = 0
	for i in arr:
		if i == 0:
			z += 1
	a = 0
	if s == 0 and (z == 1 or z == 0):
		a += 1
	else:
		a += z
	if s + a == 0:
		a += 1
	print(a)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	zeros = 0
	zeroprod = False
	for i in range(n):
		if a[i] == 0:
			zeros += 1
			zeroprod = True
	if sum(a) != 0 and (not zeroprod):
		print('0')
	elif not zeroprod and sum(a) == 0:
		print('1')
	elif zeroprod:
		if sum(a) + zeros == 0:
			print(zeros + 1)
		else:
			print(zeros)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = sum(a)
	z = a.count(0)
	if z == 0 and s != 0:
		print(0)
	elif z == 0 and s == 0:
		print(1)
	elif z >= 0 and s != 0:
		if s + z == 0:
			print(z + 1)
		else:
			print(z)
	elif z >= 0 and s == 0:
		print(z)


N = int(input())
for i in range(N):
	K = int(input())
	cnt = 0
	inl = list(map(int, input().split()))
	cnt += inl.count(0)
	if not sum(inl) + cnt:
		cnt += 1
	print(cnt)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	c = 0
	while 0 in l:
		i = l.index(0)
		l[i] += 1
		c += 1
	if sum(l) == 0:
		c += 1
	print(c)


import os
import sys
from io import BytesIO, IOBase

def main():
	t = int(input())

	def solution(arr, n):
		res = 0
		sum_arr = sum(arr)
		if 0 not in arr and sum_arr != 0:
			print(res)
			return
		if 0 in arr:
			res += arr.count(0)
			zeros_idx = [i for i in range(n) if arr[i] == 0]
			for i in zeros_idx:
				arr[i] = 1
				sum_arr += 1
		if sum_arr == 0:
			print(res + 1)
		else:
			print(res)
	for _ in range(t):
		n = int(input())
		arr = [int(x) for x in input().split()]
		solution(arr, n)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
main()


n = int(input())
for i in range(n):
	m = int(input())
	nb = list(map(int, input().split()))
	zeros = nb.count(0)
	print(zeros + int(sum(nb) + zeros == 0))


from sys import stdin, exit
input = stdin.readline
lmi = lambda : list(map(int, input().split()))
mi = lambda : map(int, input().split())
si = lambda : input().strip('\n')
ssi = lambda : input().strip('\n').split()
for _ in range(int(input())):
	n = int(input())
	arr = lmi()
	ops = 0
	for i in range(n):
		if arr[i] == 0:
			ops += 1
			arr[i] += 1
	s = sum(arr)
	if s == 0:
		print(ops + 1)
	else:
		print(ops)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	c = a.count(0)
	if sum(a) != 0 and c == 0:
		print(0)
	elif c == 0:
		if sum(a) == 0:
			print(1)
		else:
			print(abs(sum(a)))
	elif sum(a) + c == 0:
		print(c + 1)
	else:
		print(c)


import sys, math
MOD = 998244353
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	z = a.count(0)
	s = sum(a)
	ans = z + (s + z == 0)
	print(ans)


answer = []
t = int(input())
for kek in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	num_zero = 0
	total = 0
	for j in a:
		if j == 0:
			num_zero += 1
		total += j
	ans = num_zero
	if total + num_zero == 0:
		ans += 1
	answer.append(ans)
print(*answer, sep='\n')


t = int(input())
for k in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	cnt = 0
	for i in range(n):
		if arr[i] == 0:
			arr[i] += 1
			cnt += 1
	if sum(arr) == 0:
		was = False
		for i in range(n):
			if arr[i] != -1:
				arr[i] += 1
				was = True
				cnt += 1
				break
		if not was:
			for i in range(n):
				if arr[i] == -1:
					arr[i] += 2
					was = True
					cnt += 2
					break
	print(cnt)


a = int(input())
for i in range(0, a):
	S = 0
	res = 0
	n = int(input())
	arr = map(int, input().split())
	arr = list(arr)
	res = res + arr.count(0)
	S = sum(arr) + res
	if S == 0:
		res = res + 1
	print(res)


t = int(input())
q = []
for i in range(t):
	step = 0
	n = int(input())
	l = list(input().split())
	a = [int(j) for j in l]
	for j in range(n):
		if a[j] == 0:
			step += 1
			a[j] += 1
	if sum(a) == 0:
		step += 1
	q.append(step)
for i in q:
	print(i)


y = int(input())
while y != 0:
	x = int(input())
	l = list(map(int, input().split()))
	st = 0
	for i in range(x):
		if l[i] == 0:
			l[i] += 1
			st += 1
	if sum(l) != 0:
		print(st)
	else:
		print(st + 1)
	y -= 1


t = int(input())
for tt in range(t):
	n = int(input())
	A = [int(item) for item in input().split()]
	cnt = 0
	sum = 0
	for i in A:
		sum += i
		if i == 0:
			cnt += 1
	if sum + cnt == 0:
		cnt += 1
	print(cnt)


t = int(input())
for query in range(t):
	n = int(input())
	a = input().split()
	total = 0
	zeros = 0
	for x in range(n):
		a[x] = int(a[x])
	for x in range(n):
		total = total + a[x]
		if a[x] == 0:
			zeros = zeros + 1
	if total > 0:
		print(zeros)
	elif total < 0:
		total = total + zeros
		if total == 0:
			print(zeros + 1)
		else:
			print(zeros)
	elif total == 0:
		if zeros == 0:
			print(1)
		else:
			print(zeros)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	total = 0
	zeros = 0
	for x in a:
		total += x
		if x == 0:
			zeros += 1
	if total + zeros == 0:
		print(zeros + 1)
	else:
		print(zeros)


t = int(input())
for _ in range(1, t + 1):
	input()
	arr = [int(item) for item in input().split(' ')]
	steps = arr.count(0)
	sm = sum(arr)
	steps = steps + 1 if sm + steps == 0 else steps
	print(steps)


t = int(input())
ans = []
while t != 0:
	n = int(input())
	l = list(map(int, input().split()))
	zeroes = l.count(0)
	s = 0
	c = 0
	for i in range(0, len(l)):
		if l[i] == 0:
			l[i] = 1
			c = c + 1
	for i in range(0, len(l)):
		s = s + l[i]
	if s == 0:
		s = abs(s) + 1
	else:
		s = 0
	ans.append(s + c)
	t = t - 1
for i in range(0, len(ans)):
	print(ans[i])


y = input
for i in [0] * int(y()):
	y()
	l = (*map(int, y().split()),)
	v = l.count(0)
	print(v + (sum(l) + v == 0))


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if sum(a) != 0 and 0 not in a:
		print(0)
	elif 0 in a:
		if sum(a) + a.count(0) != 0:
			print(a.count(0))
		else:
			print(a.count(0) + 1)
	else:
		print(1)


t = int(input())
for i in range(t):
	n = int(input())
	li = list(map(int, input().split()))
	k = sum(li)
	c = 0
	for i in range(len(li)):
		if li[i] == 0:
			c += 1
	if c == 0:
		if k == 0:
			print(1)
		else:
			print(0)
	else:
		k += c
		if k == 0:
			print(c + 1)
		else:
			print(c)


for _ in range(int(input())):
	input()
	data = list(map(int, input().split()))
	to_add = sum((v == 0 for v in data))
	total = sum(data)
	if total + to_add == 0:
		to_add += 1
	print(to_add)


for i in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().strip().split()]
	s = sum(arr)
	zero = 0
	ans = 0
	for i in arr:
		if i == 0:
			zero += 1
	if zero == 0:
		if s == 0:
			ans = 1
		else:
			ans = 0
	elif s > 0:
		ans = zero
	elif s == 0:
		ans = zero
	elif s == -1 * zero:
		ans = zero + 1
	else:
		ans = zero
	print(ans)


from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time

def I():
	return int(input())

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

def S():
	return input()

def MS():
	return map(str, input().split())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def StoI():
	return [ord(i) - 97 for i in input()]

def ItoS(nn):
	return chr(nn + 97)

def input():
	return sys.stdin.readline().rstrip()

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
YN = {False: 'No', True: 'Yes'}
MOD = 10 ** 9 + 7
inf = float('inf')
IINF = 10 ** 10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False

def solve(T):
	n = I()
	a = LI()
	zero = 0
	total = 0
	for i in range(n):
		if a[i] == 0:
			zero += 1
		total += a[i]
	if total + zero == 0:
		print(zero + 1)
	else:
		print(zero)

def main():
	T = I()
	for i in range(T):
		solve(T)
main()


import sys

def main():
	for _ in range(int(sys.stdin.readline())):
		n = int(sys.stdin.readline())
		l = [int(x) for x in sys.stdin.readline().split()]
		c = 0
		for i in range(n):
			if l[i] == 0:
				l[i] = 1
				c += 1
		if sum(l) != 0:
			print(c)
		else:
			print(c + 1)
main()


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


def f():
	t = int(input())
	for _ in range(t):
		n = int(input())
		l = list(map(int, input().split(' ')))
		k = 0
		for i in range(n):
			if l[i] == 0:
				k += 1
				l[i] = 1
		if sum(l) != 0:
			print(k)
		else:
			flag = False
			for x in l:
				if x != -1:
					flag = True
			if flag:
				print(k + 1)
			else:
				print(k + 2)
f()


for _ in range(int(input())):
	ans = 0
	ln = int(input())
	li = list(map(int, input().split()))
	for i in range(0, ln):
		if li[i] == 0:
			ans += 1
			li[i] = 1
	if ans == 0 and sum(li) != 0:
		print(0)
	elif sum(li) == 0:
		print(ans + 1)
	else:
		print(ans)


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

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

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

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
input = sys.stdin.readline
for _ in range(ii()):
	n = ii()
	d = li()
	r = d.count(0)
	print(r) if sum(d) + r != 0 else print(r + 1)


def calc(n: int, arr: list):
	arr.sort()
	arrSum: int = 0
	arrProduct: int = 1
	zeroes: int = 0
	ans: int = 0
	for i in arr:
		arrSum += i
		arrProduct *= i
		if i == 0:
			zeroes += 1
	arrSum = arrSum
	arrProduct = arrProduct
	if arrSum != 0 and arrProduct != 0:
		return 0
	if arrProduct == 0:
		if arrSum + zeroes != 0:
			return zeroes
		else:
			return zeroes + 1
	elif arrSum == 0:
		return 1

def main():
	for _ in range(int(input())):
		n: int = int(input())
		arr: list = list(map(int, input().split()))
		print(calc(n, arr))
main()


t = int(input())
mass2 = []
for i in range(t):
	n = int(input())
	c = 0
	mass = list(map(int, input().split()))
	for j in mass:
		if j == 0:
			c += 1
	if sum(mass) + c == 0:
		c += 1
	mass2.append(c)
for i in mass2:
	print(i)


def check(arr):
	count = 0
	n = len(arr)
	while 0 in arr:
		arr.remove(0)
		count += 1
		arr.append(1)
	total = sum(arr)
	if total == 0:
		count += 1
	return count
t = int(input().rstrip())
arr = list()
result = list()
for i in range(t):
	n = int(input().rstrip())
	temp = list(map(int, input().rstrip().split()))
	arr.append(temp)
for i in range(t):
	result.append(check(arr[i]))
for i in range(t):
	print(result[i])


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 0
	for i in range(n):
		if a[i] == 0:
			a[i] += 1
			ans += 1
	if sum(a) != 0:
		print(ans)
	else:
		print(ans + 1)


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	z = sum(l)
	k1 = l.count(0)
	if z == 0:
		if k1 == 0:
			print(1)
		else:
			print(k1)
	elif k1 == 0:
		print(0)
	elif z + k1 == 0:
		print(1 + k1)
	else:
		print(k1)


def customer(l, n):
	i = 0
	count = 0
	while i < n:
		if l[i] == 0:
			l[i] = 1
			count += 1
		i += 1
	if sum(l) == 0:
		count += 1
	return count
t = int(input())
for _ in range(t):
	n = int(input())
	queries = list(map(int, input().split()))
	print(customer(queries, n))


for _ in range(int(input())):
	n = int(input())
	num = list(map(int, input().split()))
	cnt = 0
	sum = 0
	for p in num:
		sum += p
		if p == 0:
			cnt += 1
			sum += 1
	if sum == 0:
		cnt += 1
	print(cnt)


t = int(input())
for _ in range(t):
	(summ, zero_count) = (0, 0)
	input()
	for a in map(int, input().split()):
		summ += a
		zero_count += a == 0
	if summ + zero_count == 0:
		zero_count += 1
	print(zero_count)


for case in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	sum = a[0]
	product = a[0]
	s = 0
	x = 0
	for i in range(1, n):
		sum = sum + a[i]
		product = product * a[i]
	if sum != 0 and product != 0:
		s = 0
	elif sum == 0 and product != 0:
		s = 1
	elif sum != 0 and product == 0:
		for i in range(n):
			if a[i] == 0:
				x = x + 1
		if sum + x != 0:
			s = x
		else:
			s = x + 1
	elif sum == 0 and product == 0:
		for i in range(n):
			if a[i] == 0:
				x = x + 1
		if sum + x != 0:
			s = x
		else:
			s = x + 1
	print(s)


def main():
	x = int(input())
	op = []
	for i in range(0, x):
		n = int(input())
		ip = [int(item) for item in input().split(' ')]
		n_steps = 0
		for i in range(0, len(ip)):
			if ip[i] == 0:
				n_steps += 1
				ip[i] += 1
		if sum(ip) == 0:
			n_steps += 1
		op.append(n_steps)
	for i in range(len(op)):
		print(op[i])

def sum(ip):
	op = 0
	for x in ip:
		op += x
	return op

def product(ip):
	op = 0
	for x in ip:
		op *= x
	return op
main()


for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	a = lis.count(0)
	b = sum(lis) + a
	ans = a
	if b == 0:
		ans += 1
	print(ans)


t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split()))
	cnt = 0
	for i in range(0, n):
		if a[i] == 0:
			cnt += 1
			a[i] += 1
	s = sum([x for x in a])
	if s == 0:
		cnt += 1
	print(cnt)
	t -= 1


import math
I = lambda : int(input())
ID = lambda : map(int, input().split())
IL = lambda : list(ID())
t = I()
for _ in range(t):
	n = I()
	a = IL()
	cnt = 0
	for i in range(n):
		if a[i] == 0:
			a[i] = 1
			cnt += 1
	if sum(a) == 0:
		cnt += 1
	print(cnt)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	s = sum(arr)
	count0 = arr.count(0)
	mod = s + count0
	if mod == 0:
		print(count0 + 1)
	else:
		print(count0)


def nun_zero(a):
	total_op = 0
	zeros_num = a.count(0)
	total_op += zeros_num
	sum1 = sum(a) + zeros_num
	if sum1 != 0:
		return total_op
	else:
		return total_op + 1
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(s) for s in input().split(' ')]
	ans = nun_zero(a)
	print(ans)


for _ in range(int(input())):
	input()
	l = [int(x) for x in input().split()]
	cnt = 0
	for i in range(len(l)):
		if l[i] == 0:
			cnt += 1
			l[i] = 1
	s = sum(l)
	if s == 0:
		cnt += 1
	print(cnt)


from sys import stdin, stdout
tt = int(stdin.readline())
while tt > 0:
	ans = 0
	n = int(input())
	a = list(map(int, input().split()))
	c = s = 0
	for val in a:
		if val == 0:
			c += 1
		s += val
	ans += c
	if s == -c:
		ans += 1
	stdout.write(str(ans) + '\n')
	tt -= 1


case = int(input())
for i in range(case):
	num = int(input())
	list1 = [int(v) for v in input().split()]
	x = list1.count(0)
	y = sum(list1)
	if x + y == 0:
		print(x + 1)
	else:
		print(x)


def solve():
	n = int(input())
	arr = map(int, input().split())
	s = 0
	c = 0
	for x in arr:
		if x == 0:
			c += 1
			s += 1
		else:
			s += x
	if s == 0:
		c += 1
	print(c)
for _ in range(int(input())):
	solve()


for _ in range(int(input())):
	n = int(input())
	l = sorted(map(int, input().split()))
	c = 0
	f = l.count(0)
	for i in range(n):
		if l[i] == 0:
			l[i] += 1
	if sum(l) == 0:
		print(f + 1)
	else:
		print(f)


tcases = int(input())
for case in range(tcases):
	alen = int(input())
	a = [int(x) for x in input().split(' ')]
	cnt = 0
	sum = 0
	for item in a:
		if item == 0:
			cnt += 1
			item += 1
		sum += item
	if sum == 0:
		cnt += 1
	print(cnt)


T = int(input())
for _ in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	x = 0
	while sum(a) == 0 or 0 in a:
		if 0 in a:
			a[a.index(0)] += 1
		else:
			i = 0
			while a[i] + 1 == 0:
				i += 1
			a[i] += 1
		x += 1
	print(x)


t = int(input())
for zz in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	ans = a.count(0)
	if sum(a) + a.count(0) == 0:
		ans += 1
	print(ans)


import math
from collections import *
import sys
from functools import reduce

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def get_string():
	return list(input().strip().split())

def printxsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
UGLYMOD = int(1000000000.0) + 7
SEXYMOD = 998244353
MAXN = int(100000.0)
for _testcases_ in range(int(input())):
	n = int(input())
	li = get_list()
	print(li.count(0) + int(sum(li) + li.count(0) == 0))


n = int(input())
for _ in range(n):
	n = int(input())
	m = list(map(int, input().split()))
	p = 1
	s = 0
	a = 0
	for i in range(n):
		s = s + m[i]
		p = p * m[i]
		if p == 0:
			if m[i] == 0:
				m[i] = m[i] + 1
				a += 1
	s += a
	if s == 0:
		print(a + 1)
	else:
		print(a)


def solution(n, seq):
	nol = seq.count(0)
	ret = nol
	if sum(seq) + nol == 0:
		return ret + 1
	return ret
t = int(input())
for i in range(t):
	n = int(input())
	seq = list(map(int, input().split()))
	print(solution(n, seq))


for i in range(int(input())):
	n = int(input())
	a = [int(s) for s in input().split()]
	s = 0
	p = 1
	z = 0
	steps = 0
	for i in range(n):
		if a[i] == 0:
			z += 1
		s += a[i]
		p *= a[i]
	if p == 0:
		steps += z
	if s + z == 0:
		steps += 1
	print(steps)


t = int(input())
for i in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	z = 0
	for i in range(len(l)):
		if l[i] == 0:
			l[i] = l[i] + 1
			z += 1
	if sum(l) != 0:
		print(z)
	else:
		print(z + 1)


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	v = l.count(0)
	s = sum(l)
	if s + v == 0:
		v += 1
	print(v)


t = int(input())
for i in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	cnt = lst.count(0)
	sm = sum(lst) + cnt
	if sm == 0:
		cnt += 1
	print(cnt)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	steps = l.count(0)
	su = sum(l)
	if su + steps == 0:
		print(steps + 1)
	else:
		print(steps)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = sum(a)
	d = a.count(0)
	f = 0
	if d != 0 or c == 0:
		f += d
		if c + d == 0:
			f += 1
		print(f)
	else:
		print(f)


ans1 = []
for _ in range(int(input())):
	n = int(input())
	u = list(map(int, input().split()))
	ans = 0
	for i in range(n):
		if u[i] == 0:
			u[i] += 1
			ans += 1
	if sum(u) == 0:
		ans += 1
	ans1.append(ans)
print('\n'.join(map(str, ans1)))


ntc = int(input())
steps = 0
i = 0
while i < ntc:
	input()
	a = list(map(int, input().split()))
	steps += a.count(0)
	if sum(a) + steps == 0:
		steps += 1
	print(steps)
	steps = 0
	i += 1


def multiplyList(myList):
	result = 1
	for x in myList:
		result = result * x
	return result
n = 0
t = int(input())
while t > 0:
	l = int(input())
	r = list(map(int, input().split()))
	k = multiplyList(r)
	m = r.count(0)
	if m == 0:
		if sum(r) == 0:
			print(1, sep='\n')
		else:
			print(0, sep='\n')
	else:
		n = m
		if sum(r) + m == 0:
			print(n + 1, sep='\n')
		else:
			print(n, sep='\n')
	t -= 1


for _ in range(int(input())):
	input()
	array = list(map(int, input().split()))
	zeroes = array.count(0)
	print(zeroes + 1 if sum(array) + zeroes == 0 else zeroes)


import math, queue, heapq
import sys
sys.setrecursionlimit(10 ** 6)
fastinput = sys.stdin.readline
fastout = sys.stdout.write
t = int(fastinput())
while t:
	t -= 1
	n = int(fastinput())
	(count1, count0, countn1, countn, countp) = (0, 0, 0, 0, 0)
	s = 0
	for i in fastinput().split():
		x = int(i)
		s += x
		if x == 1:
			count1 += 1
		elif x == -1:
			countn1 += 1
		elif x == 0:
			count0 += 1
		elif x > 1:
			countp += 1
		else:
			countn += 1
	if count0 == 0 and s != 0:
		print(0)
	elif count0 > 0 and s + count0 == 0:
		print(count0 + 1)
	elif count0 > 0:
		print(count0)
	else:
		print(1)


from functools import reduce
t = int(input())
for _ in range(t):
	n = input()
	a = [int(_) for _ in input().split()]
	nz = a.count(0)
	if sum(a) + nz == 0:
		print(nz + 1)
	else:
		print(nz)


T = int(input().strip())
for t in range(T):
	N = int(input().strip())
	A = list(map(int, input().split()))
	s = 0
	p = 1
	zeros = 0
	for a in A:
		if a == 0:
			zeros += 1
		s += a
		p *= a
	if s != 0 and p != 0:
		print(0)
	elif p == 0:
		if s + zeros != 0:
			print(zeros)
		else:
			print(zeros + 1)
	elif s == 0:
		print(1)
	else:
		pass


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
for _ in range(ii()):
	n = ii()
	l = il()
	z = l.count(0)
	sm = sum(l)
	ans = z
	if sm + ans == 0:
		print(ans + 1)
	else:
		print(ans)


for _ in range(int(input())):
	n = int(input())
	ll = list(map(int, input().split()))
	c = ll.count(0)
	if sum(ll) + c == 0:
		c += 1
	print(c)


testCases = int(input())
for test in range(testCases):
	n = int(input())
	array = [int(x) for x in input().split()]
	zeros = 0
	addition = 0
	steps = 0
	for element in array:
		addition += element
		if element == 0:
			zeros += 1
	steps += zeros
	addition += zeros
	if addition == 0:
		steps += 1
	print(steps)


for i in range(int(input())):
	n = int(input())
	nums = [int(a) for a in input().split()]
	count = nums.count(0)
	if sum(nums) + count == 0:
		count += 1
	print(count)


count_test = int(input())
arrs = []
for i in range(count_test):
	n = int(input())
	arr = input().split(' ')
	arrs.append([int(j) for j in arr])

def calc(arr):
	count_step = 0
	for (index, elem) in enumerate(arr):
		if elem == 0:
			count_step += 1
			arr[index] += 1
	if sum(arr) == 0:
		count_step += 1
	return count_step
for i in arrs:
	print(calc(i))


for i in range(int(input())):
	a = input()
	arr = [int(num) for num in input().split()]
	print(arr.count(0) + (1 if sum(arr) + arr.count(0) == 0 else 0))


t = int(input())
while t:
	t -= 1
	input()
	n = list(map(int, input().split()))
	s = 0
	o = 0
	for x in n:
		if x == 0:
			x = 1
			o += 1
		s += x
	if s == 0:
		o += 1
	print(o)


import math

def solve(a, n):
	count = 0
	for i in range(n):
		if a[i] == 0:
			a[i] += 1
			count += 1
	if sum(a) == 0:
		return count + 1
	else:
		return count
t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	print(solve(a, n))
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	x = lst.count(0)
	boole = x + sum(lst) == 0
	print(x + boole)


def get_non_zero_distance(arr):
	zeros = 0
	for i in range(len(arr)):
		if arr[i] == 0:
			zeros += 1
			arr[i] = 1
	sum_v = sum(arr)
	if sum_v != 0:
		return zeros
	else:
		while sum_v == 0:
			sum_v += 1
			zeros += 1
		return zeros
n = int(input())
for _ in range(n):
	i = int(input())
	arr = list(map(int, input().split()))
	print(get_non_zero_distance(arr))


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	sum1 = 0
	step = 0
	for item in a:
		if item == 0:
			item += 1
			step += 1
		sum1 += item
	print(step if sum1 != 0 else step + 1)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	co = 0
	for i in range(len(arr)):
		if arr[i] == 0:
			arr[i] += 1
			co += 1
	su = sum(arr)
	if su == 0:
		print(co + 1)
	else:
		print(co)


for t in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	count_zero = l.count(0)
	sum = 0
	for i in range(0, n):
		sum += l[i]
	if sum != 0 and count_zero == 0:
		print(0)
	if sum == 0 and count_zero == 0:
		print(1)
	elif sum == 0 and count_zero != 0:
		print(count_zero)
	elif sum + count_zero != 0 and count_zero != 0:
		print(count_zero)
	elif sum + count_zero == 0 and count_zero != 0:
		print(count_zero + 1)


t = int(input())
for iii in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	k = 0
	for i in range(n):
		if a[i] == 0:
			a[i] = 1
			k += 1
	s = sum(a)
	if s == 0:
		flag = False
		for x in a:
			if x != -1:
				flag = True
				break
		k += 1
		if not flag:
			k += 1
	print(k)


for i in range(int(input())):
	a = int(input())
	t = list(map(int, input().split()))
	y = t.count(0)
	s = sum(t)
	if s + y == 0:
		print(y + 1)
	else:
		print(y)


import sys
input = sys.stdin.readline
for t in range(int(input())):
	a = int(input())
	mas = list(map(int, input().split()))
	ans = 0
	for i in range(a):
		if mas[i] == 0:
			mas[i] += 1
			ans += 1
	if sum(mas) == 0:
		ans += 1
	print(ans)


q = int(input())
while q:
	q += -1
	n = int(input())
	l = list(map(int, input().split()))
	s = 0
	ch = 0
	ans = 0
	for i in l:
		s += i
		if i == 0:
			ch += 1
	s += ch
	if s == 0:
		print(ch + 1)
	else:
		print(ch)


t = int(input())
for i in range(t):
	n = int(input())
	arr = 0
	a = [int(x) for x in input().split()]
	s = sum(a)
	for item in a:
		if item == 0:
			arr += 1
			s += 1
	if s == 0:
		print(arr + 1)
	else:
		print(arr)


x = int(input())
t = 0
for i in range(x):
	t = 0
	q = int(input())
	a = list(map(int, input().split()))
	for i in range(q):
		if a[i] == 0:
			a[i] = a[i] + 1
			t += 1
	for i in range(q):
		while sum(a) == 0:
			a[i] = a[i] + 1
			t += 1
	print(t)


import math
from collections import deque
from collections import defaultdict
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	arr = list(map(int, input().strip().split(' ')))
	sm = sum(arr)
	zr = arr.count(0)
	sm += zr
	if sm == 0:
		if min(arr) == -1 and max(arr) == -1:
			print(zr + 2)
		else:
			print(zr + 1)
	else:
		print(zr)


t = int(input())
while t:
	k = 0
	t = t - 1
	n = int(input())
	x = list(map(int, input().split()))
	if sum(x) != 0 and x.count(0) == 0:
		print(0)
	else:
		k = k + x.count(0)
		if sum(x) + k != 0:
			print(k)
		else:
			while sum(x) + k == 0:
				k = k + 1
			print(k)


n = int(input())
for i in range(n):
	sum1 = 0
	pro = 1
	count = 0
	k = int(input())
	s = [int(x) for x in input().split()]
	for j in s:
		if j == 0:
			count += 1
			sum1 += 1
		else:
			sum1 += j
			pro *= j
	if sum1 == 0:
		count += 1
	print(count)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	s = sum(l)
	a = 0
	for i in l:
		if i == 0:
			a += 1
	b = s + a
	if b == 0:
		print(a + 1)
	else:
		print(a)


from functools import reduce

def prod(iterable):
	return reduce(operator.mul, iterable, 1)

def solution(l):
	ans = []
	for i in range(len(l)):
		a = l[i]
		count = 0
		while 0 in a:
			pos = a.index(0)
			a[pos] += 1
			count = count + 1
		if sum(a) == 0:
			count += 1
		ans.append(count)
	return ans

def main():
	t = int(input())
	l = []
	for i in range(0, t):
		n = int(input())
		a = list(map(int, input().split()))
		l.append(a)
	ans = solution(l)
	for i in range(len(ans)):
		print(ans[i])
main()


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	delta = a.count(0)
	ans = delta
	if sum(a) + delta == 0:
		ans += 1
	print(ans)


t = int(input())
while t != 0:
	n = int(input())
	list1 = list(map(int, input().split()))
	count = 0
	for i in range(n):
		if list1[i] == 0:
			count += 1
	p = sum(list1) + count
	if p != 0:
		print(count)
	else:
		q = max(list1)
		r = min(list1)
		if q == -1 and r == -1:
			print(count + 2)
		else:
			print(count + 1)
	t -= 1


test_cases = int(input())
for i in range(test_cases):
	size_of_array = int(input())
	elements_of_array = list(map(int, input().split(' ')))
	steps = 0
	if elements_of_array.count(0) == 0:
		if sum(elements_of_array) == 0:
			steps += 1
	else:
		steps += elements_of_array.count(0)
		if sum(elements_of_array) + elements_of_array.count(0) == 0:
			steps += 1
	print(steps)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = a.count(0)
	c = sum(a)
	if b == 0:
		if c != 0:
			print(0)
		else:
			print(1)
	elif c + b != 0:
		print(b)
	else:
		print(b + 1)


t = int(input())
for i in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	ans = 0
	for i in range(len(arr)):
		if arr[i] == 0:
			arr[i] += 1
			ans += 1
	if sum(arr) == 0:
		ans += 1
	print(ans)


n = int(input())
for i in range(n):
	count = 0
	x = int(input())
	l = list(map(int, input().split()))
	for i in range(x):
		if l[i] == 0:
			count = count + 1
			l[i] = 1
	while 1:
		s = sum(l)
		if s != 0:
			break
		else:
			l[1] = l[1] + 1
			count = count + 1
	print(count)


n = int(input())
for x in range(n):
	t = int(input())
	k = list(map(int, input().split()))
	count = 0
	for xy in k:
		if xy == 0:
			count += 1
	if sum(k) + count == 0:
		count += 1
	print(count)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	zero_count = a.count(0)
	a_sum = sum(a)
	res = zero_count
	if a_sum + zero_count == 0:
		res += 1
	print(res)


import math
t = int(input())
ans = []
for i in range(t):
	summ = 0
	max_el_pos = 0
	k = 0
	n = int(input())
	a = input().split()
	for i in range(len(a)):
		if int(a[i]) == 0:
			a[i] = int(a[i]) + 1
			k += 1
		else:
			a[i] = int(a[i])
		summ += a[i]
		if a[max_el_pos] < a[i]:
			max_el_pos = i
	if summ == 0:
		if a[max_el_pos] == -1:
			k += 2
		else:
			k += 1
	ans.append(k)
for i in range(t):
	print(ans[i])


test = int(input(''))
while test:
	test -= 1
	n = int(input(''))
	n_input = input()
	arr = list(map(int, n_input.split(' ')))
	num = arr.count(0)
	flag = sum(arr) + num == 0
	print(num + flag)


from math import ceil, sqrt

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def li():
	return list(mi())
t = ii()
while t:
	t -= 1
	n = ii()
	a = li()
	x = a.count(0)
	s = sum(a)
	if s == 0:
		if x == 0:
			print('1')
		else:
			print(x)
	elif x > 0:
		if x + s == 0:
			print(x + 1)
		else:
			print(x)
	else:
		print('0')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	count = a.count(0)
	if 0 in a:
		for (i, num) in enumerate(a):
			if num == 0:
				a[i] = 1
	if sum(a) == 0:
		for (i, num) in enumerate(a):
			if num != -1:
				a[i] += 1
				count += 1
				break
	if sum(a) == 0:
		count += 2
	print(count)


x = int(input())
y = []
for c in range(x):
	input()
	y.append(list(map(int, input().split())))
zeros = []
neg = []
for c in range(x):
	zero = 0
	negs = []
	for cc in range(len(y[c])):
		if y[c][cc] == 0:
			y[c][cc] = 1
			zero = zero + 1
		if y[c][cc] < 0:
			negs.append(y[c][cc])
	neg.append(negs)
	zeros.append(zero)
	zero = 0
for c in range(len(y)):
	sum = 0
	for cc in range(len(y[c])):
		sum = sum + y[c][cc]
	if len(neg[c]) == len(y[c]):
		print(0)
		continue
	if len(y[c]) == 1:
		if y[c][0] == 1 and zeros[c] == 1:
			print(1)
		else:
			print(0)
	elif sum > 0 or sum < 0:
		print(zeros[c])
	else:
		print(zeros[c] + 1)


t = int(input().strip())
for q in range(t):
	n = int(input().strip())
	a = [int(i) for i in input().strip().split(' ')]
	answ = 0
	summ = sum(a)
	mark = 0
	k = 0
	for i in range(n):
		if a[i] == 0:
			answ += 1
			summ += 1
			a[i] += 1
			mark = 1
		if a[i] > 0:
			mark = 1
		if a[i] < 0:
			k += -a[i] - 1
	if summ == 0:
		if mark == 1:
			answ += 1
			summ += 1
		elif k > 0:
			answ += 1
			summ += 1
		else:
			answ += 2
			summ += 2
	print(answ)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	os = 0
	sm = 0
	for z in a:
		if z == 0:
			os += 1
			sm += 1
		else:
			sm += z
	if sm == 0:
		print(os + 1)
	else:
		print(os)


t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split()))

	def mul(b):
		res = 1
		for i in range(len(b)):
			res *= b[i]
		return res
	if sum(a) != 0 and mul(a) != 0:
		print('0')
	elif sum(a) == 0 and mul(a) != 0:
		print('1')
	else:
		c1 = 0
		for i in range(len(a)):
			if a[i] == 0:
				a[i] = 1
				c1 += 1
		if sum(a) == 0:
			print(c1 + 1)
		else:
			print(c1)
	t = t - 1


def int_as_array(num):
	return list(map(int, [y for y in str(num)]))

def array_as_int(arr):
	return int(''.join(map(str, arr)))

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

def read_int():
	return int(input())

def solve(array):
	steps = 0
	steps += array.count(0)
	s = sum(array) + steps
	if s == 0:
		steps += 1
	return steps
T = int(input())
for i in range(T):
	n = read_int()
	array = read_int_array()
	print(solve(array))


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	ans = []
	for _ in range(n):
		k = I()
		l = LI()
		cnt = l.count(0)
		sm = 0
		for x in l:
			if x == 0:
				x += 1
			sm += x
		if sm == 0:
			cnt += 1
		ans.append(cnt)
	for x in ans:
		print(x)
main()


for _ in range(int(input())):
	input()
	li = list(map(int, input().split()))
	total = sum(li) + li.count(0)
	print(li.count(0) + 1 if total == 0 else li.count(0))


t = int(input())
while t != 0:
	n = int(input())
	arr = [int(x) for x in input().split()]
	sum1 = sum(arr)
	count_zeroes = arr.count(0)
	if count_zeroes == 0:
		if sum1 == 0:
			print(1)
		else:
			print(0)
	else:
		sum1 += count_zeroes
		if sum1 == 0:
			print(count_zeroes + 1)
		else:
			print(count_zeroes)
	t = t - 1


for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	operations = 0
	for i in range(0, len(arr)):
		if arr[i] == 0:
			arr[i] = 1
			operations += 1
	while sum(arr) == 0:
		mind = arr.index(max(arr))
		arr[mind] += 1
		operations += 1
	print(operations)


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


t = int(input())
for p in range(t):
	n = int(input())
	lis = list(map(int, input().split()))
	x = lis.count(0)
	suml = sum(lis) + x
	if suml == 0:
		x = x + 1
	print(x)


for _ in range(int(input())):
	input()
	A = list(map(int, input().split()))
	x = A.count(0)
	print(x + (x + sum(A) == 0))


def prod(a):
	p = 1
	for i in a:
		p *= i
	return p
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if sum(a) != 0 and prod(a) != 0:
		print(0)
	else:
		c = 0
		if prod(a) == 0:
			for i in range(n):
				if a[i] == 0:
					c += 1
					a[i] += 1
		if sum(a) == 0:
			c += 1
		print(c)


def non_zero(a):
	res = 0
	s = sum(a)
	c = a.count(0)
	res += c
	s += c
	if s == 0:
		res = res + 1
	return res
n = int(input())
for i in range(n):
	size = int(input())
	a = list(map(int, input().split()))
	result = non_zero(a)
	print(result, end='\n')


for i in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split()][:n]
	c = l.count(0)
	if sum(l) + c != 0:
		print(c)
	else:
		print(c + 1)


t = int(input())
num = list()
array = list()
for j in range(t):
	num.append(int(input()))
	array.append(list(map(int, input().split())))
for j in range(t):
	count = array[j].count(0)
	if sum(array[j]) + count == 0:
		array[j][0] += 1
		count += 1
	print(count)


t = int(input())
for i in range(t):
	n = int(input())
	li = [int(num) for num in input().split()]
	if sum(li) == 0 and li.count(0) == 0:
		print(1)
	else:
		f = li.count(0)
		if sum(li) + f != 0:
			print(f)
		else:
			print(f + 1)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	zero = 0
	if sum(a) == 0 and 0 not in a:
		print(1)
	else:
		for i in a:
			if i == 0:
				zero += 1
		if sum(a) + zero == 0:
			print(zero + 1)
		else:
			print(zero)


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	ans = 0
	for x in a:
		if x == 0:
			ans += 1
	if sum(a) + ans == 0:
		ans += 1
	print(ans)


q = int(input())
for i in range(q):
	n = int(input())
	s = [int(i) for i in input().split()]
	w1 = s.count(0)
	som = sum(s)
	if som + w1 == 0:
		print(w1 + 1)
	else:
		print(w1)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	s = 0
	a = l.count(0)
	if a >= 1:
		s = s + a
	sum1 = sum(l)
	if sum1 == 0 and a >= 1:
		print(s)
	elif sum1 == 0 and a == 0:
		print(s + 1)
	elif sum1 + a == 0:
		print(s + 1)
	else:
		print(s)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	cnt = 0
	x = a.count(0)
	ans = sum(a) + x
	if ans != 0:
		cnt += x
	else:
		cnt += x + 1
	print(cnt)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	cnt = a.count(0)
	cnt += sum(a) + cnt == 0
	print(cnt)


for i in range(int(input())):
	n = int(input())
	c = 0
	d = 0
	l = list(map(int, input().split()))
	for i in range(n):
		if l[i] == 0:
			c = c + 1
	if c == 0 and sum(l) == 0:
		print(1)
	else:
		y = sum(l) + c
		if y == 0:
			print(c + 1)
		else:
			print(c)


from sys import stdin, stdout
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	c = 0
	for i in range(n):
		if a[i] == 0:
			a[i] = 1
			c += 1
	if sum(a) == 0:
		c += 1
	stdout.write(str(c) + '\n')


def summ(a):
	k = 0
	for i in a:
		k += i
	return k
a = []
n = int(input())
for i in range(n):
	input()
	a.append(list(map(int, input().split())))
answ = [0] * n
for j in range(n):
	answ[j] += a[j].count(0)
	while a[j].count(0) > 0:
		a[j][a[j].index(0)] = 1
	if summ(a[j]) == 0:
		answ[j] += 1
print(*answ, sep='\n')


from collections import deque

def Find_Solutions(arr):
	count = 0
	for num in arr:
		if num == 0:
			count += 1
	arr[0] += count
	count2 = 0
	while sum(arr) == 0:
		arr[0] += 1
		count2 += 1
	return count + count2
n = int(input())
for _ in range(n):
	n2 = input()
	line = input()
	line = line.split()
	line[:] = [int(elem) for elem in line]
	print(Find_Solutions(line))


from operator import itemgetter
from collections import Counter

def solve(a):
	ans = 0
	s = sum(a)
	for aa in a:
		if aa == 0:
			ans += 1
			s += 1
	if s == 0:
		ans += 1
	print(ans)

def main():
	t = int(input())
	for i in range(t):
		input()
		a = list(map(int, list(input().split())))
		solve(a)
main()


t = int(input())
for k in range(t):
	n = int(input())
	arr = list(map(int, input().split()[:n]))
	c0 = 0
	for i in range(n):
		if arr[i] == 0:
			arr[i] = 1
			c0 += 1
	s = sum(arr)
	if s == 0:
		c0 += 1
	print(c0)


from collections import defaultdict
import sys, math
f = None
try:
	f = open('q1.input', 'r')
except IOError:
	f = sys.stdin
if 'xrange' in dir(__builtins__):
	range = xrange
sys.setrecursionlimit(10 ** 2)

def print_case_iterable(case_num, iterable):
	print('Case #{}: {}'.format(case_num, ' '.join(map(str, iterable))))

def print_case_number(case_num, iterable):
	print('Case #{}: {}'.format(case_num, iterable))

def print_iterable(A):
	print(' '.join(A))

def read_int():
	return int(f.readline().strip())

def read_int_array():
	return [int(x) for x in f.readline().strip().split(' ')]

def rns():
	a = [x for x in f.readline().split(' ')]
	return (int(a[0]), a[1].strip())

def read_string():
	return list(f.readline().strip())

def ri():
	return int(f.readline().strip())

def ria():
	return [int(x) for x in f.readline().strip().split(' ')]

def rns():
	a = [x for x in f.readline().split(' ')]
	return (int(a[0]), a[1].strip())

def rs():
	return list(f.readline().strip())

def bi(x):
	return bin(x)[2:]
from collections import deque
import math
NUMBER = 10 ** 9 + 7

def factorial(n):
	M = NUMBER
	f = 1
	for i in range(1, n + 1):
		f = f * i % M
	return f

def mult(a, b):
	return a * b % NUMBER

def minus(a, b):
	return (a - b) % NUMBER

def plus(a, b):
	return (a + b) % NUMBER

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, y, x) = egcd(b % a, a)
		return (g, x - b // a * y, y)

def modinv(a):
	m = NUMBER
	(g, x, y) = egcd(a, m)
	if g != 1:
		raise Exception('modular inverse does not exist')
	else:
		return x % m

def choose(n, k):
	if n < k:
		assert false
	return mult(factorial(n), modinv(mult(factorial(k), factorial(n - k)))) % NUMBER
from collections import deque, defaultdict
import heapq
from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc

def dfs(g, timeIn, timeOut, depths, parents):
	cnt = 0
	stack = [[1, 0, 0, 0]]
	while stack:
		(v, neig_i, parent, depth) = stack[-1]
		parents[v] = parent
		depths[v] = depth
		if neig_i == 0:
			timeIn[v] = cnt
			cnt += 1
		while neig_i < len(g[v]):
			u = g[v][neig_i]
			if u == parent:
				neig_i += 1
				continue
			stack[-1][1] = neig_i + 1
			stack.append([u, 0, v, depth + 1])
			break
		if neig_i == len(g[v]):
			stack.pop()
			timeOut[v] = cnt
			cnt += 1
cnt = 0

@bootstrap
def dfs(v, adj, timeIn, timeOut, depths, parents, parent=0, depth=0):
	global cnt
	parents[v] = parent
	depths[v] = depth
	timeIn[v] = cnt
	cnt += 1
	for u in adj[v]:
		if u == parent:
			continue
		yield dfs(u, adj, timeIn, timeOut, depths, parents, v, depth + 1)
	timeOut[v] = cnt
	cnt += 1
	yield

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)

def get_num_2_5(n):
	twos = 0
	fives = 0
	while n > 0 and n % 2 == 0:
		n //= 2
		twos += 1
	while n > 0 and n % 5 == 0:
		n //= 5
		fives += 1
	return (twos, fives)

def shift(a, i, num):
	for _ in range(num):
		(a[i], a[i + 1], a[i + 2]) = (a[i + 2], a[i], a[i + 1])

def equal(x, y):
	return abs(x - y) <= 1e-09

def solution(a, n):
	res = 0
	for i in range(n):
		if a[i] == 0:
			a[i] += 1
			res += 1
	if sum(a) == 0:
		return res + 1
	return res

def main():
	T = 1
	T = ri()
	for i in range(T):
		n = ri()
		a = ria()
		x = solution(a, n)
		if 'xrange' not in dir(__builtins__):
			print(x)
		else:
			(print >> output, str(x))
	if 'xrange' in dir(__builtins__):
		print(output.getvalue())
		output.close()
if 'xrange' in dir(__builtins__):
	import cStringIO
	output = cStringIO.StringIO()
main()


for _ in range(int(input())):
	n = int(input())
	x = [int(n) for n in input().split()]
	a = {}
	for i in x:
		if i not in a:
			a[i] = 0
		a[i] += 1
	s = sum(x)
	if s == 0:
		if 0 in a:
			print(a[0])
		else:
			print(1)
	else:
		if 0 not in a:
			a[0] = 0
		c = 0
		if s + a[0] == 0:
			c = 1
		print(a[0] + c)


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	(p, n) = (0, 0)
	sol = 0
	for i in a:
		if i > 0:
			p += i
		elif i < 0:
			n += i
		else:
			sol += 1
			p += 1
	if p + n == 0:
		sol += 1
	print(sol)

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


t = int(input())
for _ in range(t):
	n = int(input())
	(*arr,) = map(int, input().split())
	ans = 0
	for i in range(n):
		if arr[i] == 0:
			arr[i] += 1
			ans += 1
	x = sum(arr)
	if x == 0:
		ans += 1
	print(ans)


n = int(input())
for i in range(n):
	s = int(input())
	c = 0
	li = []
	k = list(map(int, input().split()))
	for j in k:
		if j == 0:
			c += 1
			li.append(1)
		else:
			li.append(j)
	if sum(li) == 0:
		print(c + 1)
	else:
		print(c)


for _ in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split()]
	s = 0
	c = 0
	for i in l:
		if i == 0:
			s += 1
			c += 1
		else:
			s += i
	if s == 0:
		print(c + 1)
	else:
		print(c)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	z = a.count(0)
	s = sum(a)
	print(z + int(s + z == 0))


for ttt in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	zero = arr.count(0)
	add = sum(arr)
	if add != 0 and zero == 0:
		print(0)
	elif add + zero == 0:
		print(max(1, zero + 1))
	else:
		print(max(1, zero))


for i in range(int(input())):
	input()
	a = list(map(int, input().split()))
	zero = a.count(0)
	print(zero if sum(a) + zero * 1 != 0 else zero + 1)


t = int(input().strip())
for i in range(t):
	l = int(input().strip())
	lis = list(map(int, input().strip().split()))
	c = lis.count(0)
	for i in range(c):
		remInd = lis.index(0)
		lis[remInd] += 1
	sum = 0
	pr = 1
	for i in lis:
		sum += i
		pr *= i
	if sum == 0 or pr == 0:
		c += 1
	print(c)


def main():
	for _ in range(int(input())):
		n = int(input())
		x = list(map(int, input().split()))
		y = len([i for i in x if i == 0])
		if sum(x) + y == 0:
			print(y + 1)
		else:
			print(y)
main()


for i in range(int(input())):
	x = input()
	x = list(map(int, input().split()))
	c = 0
	for i in range(len(x)):
		if x[i] == 0:
			x[i] = 1
			c += 1
	if sum(x) == 0:
		c += 1
	print(c)


from sys import stdin
from bisect import bisect_left as bl
from bisect import bisect_right as br

def input():
	return stdin.readline()[:-1]

def intput():
	return int(input())

def sinput():
	return input().split()

def intsput():
	return map(int, sinput())

class RangedList:

	def __init__(self, start, stop, val=0):
		self.shift = 0 - start
		self.start = start
		self.stop = stop
		self.list = [val] * (stop - start)

	def __setitem__(self, key, value):
		self.list[key + self.shift] = value

	def __getitem__(self, key):
		return self.list[key + self.shift]

	def __repr__(self):
		return str(self.list)

	def __iter__(self):
		return iter(self.list)
t = intput()
for _ in range(t):
	n = intput()
	a = list(intsput())
	s = sum(a)
	zeros = []
	for i in range(n):
		if a[i] == 0:
			zeros.append(i)
	s += len(zeros)
	r = 0 if s else 1
	print(len(zeros) + r)


t = int(input())
while t > 0:
	n = int(input())
	arr = input()
	a = list(map(int, arr.split(' ')))
	p = 1
	s = 0
	count = 0
	count1 = 0
	for i in range(0, n):
		if a[i] != 0:
			s = s + a[i]
		p = p * a[i]
		if a[i] == 0:
			count += 1
		if a[i] > 0:
			count1 += 1
	if p != 0 and s != 0:
		print(0)
	elif p == 0 and s == 0:
		print(count)
	elif s == 0 and p != 0:
		if count1 != 0:
			print(1)
		else:
			print(2)
	else:
		s = 0
		for i in range(0, n):
			if a[i] == 0:
				a[i] = a[i] + 1
			s = s + a[i]
		if s != 0:
			print(count)
		else:
			print(count + 1)
	t = t - 1


for i in range(int(input())):
	number = int(input())
	first = list(map(int, input().split()))
	counter = first.count(0)
	print(counter + (sum(first) + counter == 0))


for _ in range(int(input())):
	n = int(input())
	l = [*map(int, input().split())]
	val = l.count(0)
	ans = 0
	for i in range(n):
		if l[i] == 0:
			l[i] = 1
	x = sum(l)
	if x == 0:
		ans += 1
	ans += val
	print(ans)


import math, collections, sys
input = sys.stdin.readline

def case():
	n = int(input())
	a = list(map(int, input().split()))
	count = 0
	for i in range(n):
		if a[i] == 0:
			a[i] += 1
			count += 1
	if sum(a) == 0:
		count += 1
	print(count)
for _ in range(int(input())):
	case()


for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	k = 0
	for j in range(0, n):
		if arr[j] == 0:
			k += 1
	if sum(arr) + k == 0:
		print(k + 1)
	else:
		print(k)


import sys
from math import *
input = sys.stdin.readline
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = [int(x) for x in input().split()]
	if sum(a) != 0 and a.count(0) == 0:
		print(0)
		continue
	c = a.count(0)
	s = sum(a)
	s += c
	if s != 0:
		print(c)
		continue
	else:
		print(c + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	lis = []
	lis = list(map(int, input().split()))
	s = sum(lis)
	k = lis.count(0)
	p = 0
	if s != 0 and k == 0:
		print(0)
	else:
		if k != 0:
			s += k
			p += k
		if s == 0:
			p += 1
		print(p)


for x in range(int(input())):
	input()
	inp = sorted(map(int, input().split()))
	matrix = []
	for y in range(len(inp)):
		if inp[y] == 0:
			matrix.append(inp[y] + 1)
		else:
			matrix.append(inp[y])
	if sum(matrix) == 0:
		matrix[-1] = matrix[-1] + 1
	print(sum(matrix) - sum(inp))


n = int(input())
arr = []
for i in range(n):
	l = int(input())
	x = [int(x) for x in input().split()]
	steps = 0
	a = []
	for num in x:
		if num == 0:
			num = 1
			steps += 1
		a.append(num)
	if sum(a) == 0:
		steps += 1
	arr.append(steps)
for num in arr:
	print(num)


n = int(input())
for i in range(n):
	p = int(input())
	l = list(map(int, input().split()))
	sum1 = 0
	count = 0
	for j in range(p):
		if l[j] == 0:
			l[j] = 1
			count += 1
	sum1 = sum(l)
	if sum1 == 0:
		l[0] += 1
		count += 1
	print(count)


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
import math

def bin1(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = k ** mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin1(mid + 1, r, k, t, b, val, ans)
		else:
			return bin1(l, mid - 1, k, t, b, val, ans)

def bin2(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = t * k ** mid + b * mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin2(l, mid - 1, k, t, b, val, ans)
		else:
			return bin2(mid + 1, r, k, t, b, val, ans)

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	l = []
	for i in range(2, n + 1):
		if prime[i]:
			l.append(i)
	return l

def bin(l, r, ll, val):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		if val >= ll[mid][0] and val <= ll[mid][1]:
			return mid
		elif val < ll[mid][0]:
			return bin(l, mid - 1, ll, val)
		else:
			return bin(mid + 1, r, ll, val)

def deci(n):
	s = ''
	while n != 0:
		if n % 2 == 0:
			n = n // 2
			s = '0' + s
		else:
			n = n // 2
			s = '1' + s
	return s

def diff(s1, s2):
	if len(s1) < len(s2):
		v = len(s1)
		while v != len(s2):
			s1 = '0' + s1
			v = v + 1
	else:
		v = len(s2)
		while v != len(s1):
			s2 = '0' + s2
			v = v + 1
	c = 0
	for i in range(len(s1)):
		if s1[i:i + 1] != s2[i:i + 1]:
			c = c + 1
	return c
from sys import stdin, stdout

def fac(a, b):
	v = a
	while a != b:
		v *= a - 1
		a = a - 1
	return v

def bino(l, r, n):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		val1 = math.log(n / mid + 1, 2)
		val2 = int(val1)
		if val1 == val2:
			return val1
		elif val1 < 1.0:
			return bino(l, mid - 1, n)
		else:
			return bino(mid + 1, r, n)

def binary(l, r, ll, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		if ll[mid] == val:
			return ll[mid]
		elif ll[mid] < val:
			ans = ll[mid]
			return binary(mid + 1, r, ll, val, ans)
		else:
			return binary(l, mid - 1, ll, val, ans)

def check(n):
	v = 1
	while n != 0:
		if n % 10 == 0 or n % 10 == 1:
			n = n // 10
		else:
			v = 0
			break
	return v
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split(' ')))
	c = 0
	for i in range(n):
		if l[i] == 0:
			c += 1
	if c == 0:
		if sum(l) == 0:
			print(1)
		else:
			print(0)
	elif sum(l) + c == 0:
		print(c + 1)
	else:
		print(c)


a = int(input())
for k in range(a):
	b = int(input())
	c = list(map(int, input().split(' ')))
	d = c.count(0)
	sum = 0
	for j in c:
		if j == 0:
			sum += 1
		else:
			sum += j
	if sum == 0:
		print(d + 1)
	else:
		print(d)


import sys

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

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(INT()):
	N = INT()
	A = LIST()
	sm = sum(A)
	cnt0 = A.count(0)
	cnt = cnt0
	sm += cnt0
	if sm == 0:
		cnt += 1
	print(cnt)


for i in range(int(input())):
	c = int(input())
	f = [int(i) for i in input().split()]
	k = 0
	if 0 in f:
		k = f.count(0)
		if sum(f) + k == 0:
			k += 1
	elif sum(f) == 0:
		k = 1
		if 0 in f:
			k = f.count(0) + 1
			if sum(f) + k == 0:
				k += 1
	print(k)


t = int(input())
while t > 0:
	n = int(input())
	arr = list(map(int, input().split()))
	s = st = 0
	for i in arr:
		if i == 0:
			s += 1
			st += 1
		else:
			s += i
	if s == 0:
		st += 1
	print(st)
	t -= 1


t = int(input())
while t > 0:
	n = int(input())
	a = [int(ele) for ele in input().split()]
	count = 0
	for i in range(n):
		if a[i] == 0:
			a[i] += 1
			count += 1
	sumi = 0
	for ele in a:
		sumi += ele
	if sumi == 0:
		count += 1
	print(count)
	t -= 1


q = int(input())
for _ in range(q):
	n = int(input())
	s = list(map(int, input().split()))
	ans = s.count(0)
	t = sum(s) + ans
	print(ans + (t == 0))


def su(a):
	x = 0
	for i in a:
		x = x + i
	return x

def pro(a):
	x = 1
	for i in a:
		x = x * i
	return x
n = int(input())
b = []
for i in range(n):
	m = int(input())
	a = list(map(int, input().split()))
	c = a
	s = su(a)
	p = pro(a)
	k = 0
	if s == 0 and p != 0:
		for i in range(len(a)):
			if a[i] > 0:
				a[i] += 1
				k = k + 1
				break
	elif s != 0 and p == 0:
		for i in range(len(a)):
			if a[i] == 0:
				a[i] = a[i] + 1
				k = k + 1
		if sum(a) == 0:
			for i in range(len(a)):
				if a[i] > 0:
					a[i] += 1
					k += 1
					break
	elif s == 0 and p == 0:
		for i in range(len(a)):
			if a[i] == 0:
				a[i] += 1
				k += 1
		if sum(a) == 0:
			for i in range(len(a)):
				if a[i] > 0:
					a[i] += 1
					k += 1
					break
	b.append(k)
for i in b:
	print(i)


t = int(input(''))
x = [0] * t
a = []
for y in range(0, t):
	moves = 0
	a = a.clear()
	n = int(input(''))
	a1 = input('').split()
	a = [int(z) for z in a1]
	for aa in range(0, n):
		if a[aa] % 10 == 0 and a[aa] != 0:
			moves -= 1
			if a[aa] % 100 == 0:
				moves -= 1
	astr = ''.join(a1)
	moves += astr.count('0')
	if sum(a) + moves == 0:
		moves += 1
	x[y] = moves
for y1 in range(0, t):
	print(x[y1])


tc = int(input())
for t in range(tc):
	n = int(input())
	l = input()
	l = [int(i) for i in l.split(' ')]
	step = 0
	sum = 0
	for i in l:
		if i == 0:
			sum += 1
			step += 1
		else:
			sum += i
	if sum == 0:
		step += 1
	print(step)
5


t = int(input())
for g in range(t):
	n = int(input())
	q = [int(f) for f in input().split()]
	a = q.count(0)
	b = sum(q)
	if a == 0:
		if b == 0:
			print(1)
		else:
			print(0)
	elif b == -a:
		print(a + 1)
	else:
		print(a)


a = []
n = int(input())
for i in range(n):
	x = input()
	a.append([int(j) for j in input().split()])
ans = []
for i in a:
	flag = 0
	if 0 in i:
		flag = i.count(0)
		i = [1 if x == 0 else x for x in i]
	if sum(i) == 0:
		i[0] += 1
		flag += 1
	ans.append(flag)
print(*ans, sep='\n')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	an = 0
	for i in range(len(a)):
		if a[i] == 0:
			an += 1
			a[i] += 1
	if sum(a) == 0:
		print(an + 1)
	else:
		print(an)


for _ in range(int(input())):
	s = int(input())
	arr = map(int, input().split())
	sum_ = 0
	zero_counter = 0
	for i in arr:
		sum_ += i
		if i == 0:
			zero_counter += 1
	if zero_counter == 0:
		if sum_ != 0:
			print(0)
		else:
			print(1)
	elif sum_ + zero_counter == 0:
		print(zero_counter + 1)
	else:
		print(zero_counter)


t = int(input())
while t:
	n = int(input())
	a = input().split()
	for i in range(n):
		a[i] = int(a[i])
	zero = a.count(0)
	total = sum(a)
	ans = zero
	total = sum(a) + zero
	if total == 0:
		ans += 1
	print(ans)
	t -= 1


n = int(input())
for i in range(0, n):
	o = int(input())
	p = input().rstrip().split(' ')
	A = p.count('0')
	if A > 0:
		ans = A
		T = 0
		for j in range(0, len(p)):
			T += int(p[j])
		T += A
		if T == 0:
			print(ans + 1)
		else:
			print(ans)
	else:
		T = 0
		for j in range(0, len(p)):
			T += int(p[j])
		if T == 0:
			print(1)
		else:
			print(0)


def check(a):
	count = 0
	p = sum(a)
	q = a.count(0)
	count += q
	p += q
	if p == 0:
		count += 1
	print(count)
t = int(input())
j = []
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	check(a)


def suma(z):
	m = 0
	for i in z:
		m = m + int(i)
	return m
t = int(input())
for i in range(t):
	k = int(input())
	s = input().split()
	j = s.count('0')
	if suma(s) + j == 0:
		j = j + 1
	print(j)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = [int(x) for x in input().split()]
	if sum(a) + a.count(0) == 0:
		print(a.count(0) + 1)
	elif a.count(0) > 0:
		print(a.count(0))
	elif sum(a) != 0:
		print(0)
	else:
		print(1)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(a.count(0) + int(sum(a) + a.count(0) == 0))


t = int(input())
for _ in range(t):
	N = int(input())
	arr = list(map(int, input().split()))
	cnt = arr.count(0)
	if cnt + sum(arr) == 0:
		cnt += 1
	print(cnt)


for i in range(int(input())):
	k = 0
	input()
	a = [int(_) for _ in input().split()]
	suma = sum(a)
	suma += a.count(0)
	k += a.count(0)
	if suma == 0:
		k += 1
	print(k)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	c = arr.count(0)
	ans = c
	x = sum(arr) + c
	if x != 0:
		print(c)
	elif c != 0:
		print(c + 1)
	else:
		print(1)


for _ in range(int(input())):
	n = int(input())
	data = [int(x) for x in input().split()]
	zerocount = data.count(0)
	add = sum(data)
	add += zerocount
	if add == 0:
		print(zerocount + 1)
	else:
		print(zerocount)


def f():
	n = int(input())
	for i in range(n):
		m = int(input())
		ans = 0
		sum_of_digit = 0
		k = input().split(' ')
		for j in range(len(k)):
			if int(k[j]) == 0:
				ans += 1
				k[j] = int(k[j]) + 1
			sum_of_digit += int(k[j])
		if sum_of_digit == 0:
			ans += 1
		print(ans)
f()


def solve(arr):
	ans = 0
	total = 0
	for i in range(len(arr)):
		if arr[i] == 0:
			ans += 1
			arr[i] = 1
		total += arr[i]
	if total == 0:
		ans += 1
	return ans
T = int(input())
for i in range(T):
	input()
	arr = [int(n) for n in input().split()]
	print(solve(arr))


t = int(input())
while t != 0:
	n = int(input())
	arr = sorted(list(map(int, input().split())))
	sum = 0
	totalZero = 0
	result = 0
	for i in range(n):
		sum += arr[i]
		if arr[i] == 0:
			totalZero += 1
	if totalZero > 0:
		result += totalZero
		sum += totalZero
	if sum == 0:
		result += 1
	print(result)
	t -= 1


import sys
inp = sys.stdin.readline
input = lambda : inp().strip()
flush = sys.stdout.flush

def iin():
	return int(input())

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

def main():
	t = iin()
	while t:
		t -= 1
		n = iin()
		a = lin()
		sm = sum(a)
		op = 0
		for i in range(n):
			if a[i] == 0:
				a[i] += 1
				op += 1
		sm = sum(a)
		if sm == 0:
			for i in range(n):
				if a[i] > 0:
					a[i] += 1
			op += 1
		print(op)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	zero = arr.count(0)
	s = sum(arr) + zero
	if s is 0:
		print(zero + 1)
	else:
		print(zero)


def check(n, l):
	s = 0
	a = sum(l)
	z = l.count(0)
	if z == 0 and a != 0:
		print(0)
	else:
		s = s + z
		a = a + z
		while 1:
			if a != 0:
				print(s)
				break
			else:
				a = a + 1
				s = s + 1
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	check(n, l)


import functools
for _ in range(int(input())):
	n = int(input())
	c = 0
	c1 = 0
	li = [int(i) for i in input().split()]
	k = functools.reduce(lambda a, b: a * b, li)
	c = li.count(0)
	if c > 0:
		c1 = c
		if sum(li) + c == 0:
			c1 += 1
	elif sum(li) == 0:
		c1 = 1
	else:
		c1 = 0
	print(c1)


for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	r = lst.count(0)
	l = []
	for i in lst:
		if i == 0:
			l.append(i + 1)
		else:
			l.append(i)
	if sum(l) == 0:
		print(r + 1)
	else:
		print(r)


T = int(input())
for i in range(T):
	a = int(input())
	b = list(map(int, input().split()))
	c = b.count(0)
	d = sum(b) + c
	if d == 0:
		print(c + 1)
	else:
		print(c)


for t in range(int(input())):
	n = int(input())
	a = [int(v) for v in input().split()]
	(s, c) = (0, 0)
	for i in range(n):
		if a[i] == 0:
			a[i] += 1
			c += 1
		s += a[i]
	if s == 0:
		for i in range(n):
			if a[i] > 0:
				a[i] += 1
				c += 1
				break
			elif a[i] != -1:
				a[i] += 1
				c += 1
				break
	print(c)


t = int(input())
for i in range(t):
	z = 0
	n = int(input())
	v = input().split()
	for k in range(n):
		if v[k] == '0':
			z += 1
			v[k] = int(v[k]) + 1
		else:
			v[k] = int(v[k])
	if sum(v) == 0:
		z += 1
	print(z)


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


a = int(input())
for i in range(a):
	b = int(input())
	c = list(map(int, input().split()))
	cnt = 0
	g = 0
	d = 0
	for i in range(b):
		if c[i] == 0:
			c[i] = c[i] + 1
			cnt += 1
	if sum(c) == 0:
		cnt += 1
	print(cnt)


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		N = int(input())
		A = [int(x) for x in input().split()]
		if sum(A) == 0 and A.count(0) == 0:
			print(1)
		elif A.count(0) > 0:
			if A.count(0) == -sum(A):
				print(A.count(0) + 1)
			else:
				print(A.count(0))
		else:
			print(0)
main()


t = int(input())
for _ in range(t):
	ops = 0
	n = int(input())
	arr = [int(i) for i in input().split()]
	for i in range(n):
		if arr[i] == 0:
			arr[i] = 1
			ops += 1
	if sum(arr) == 0:
		ops += 1
	print(ops)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	nld = str(input())
	duml = nld.split()
	res = 0
	ress = 0
	for i in duml:
		i = int(i)
		if i == 0:
			res += 1
			i += 1
		ress += i
	if ress == 0:
		res += 1
	print(res)


def non_zero(n, arr):
	zeros = 0
	count = 0
	for numb in arr:
		zeros = zeros + 1 if numb == 0 else zeros + 0
		count += numb
	if zeros + count == 0:
		return zeros + 1
	if zeros != 0:
		return zeros
	if count == 0:
		return 1
	return 0
t = int(input())
tests = []
for i in range(t):
	tests.append((int(input()), list(map(int, input().rstrip().split()))))
for t in tests:
	print(non_zero(t[0], t[1]))


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	ans = 0
	for i in range(n):
		if not a[i]:
			ans += 1
			a[i] += 1
	if not sum(a):
		ans += 1
	print(ans)


def checkSum(Nums, n):
	count = 0
	s = sum(Nums)
	if s == 0:
		while s == 0:
			if 0 in Nums:
				Nums[Nums.index(0)] += 1
				s = sum(Nums)
				count += 1
			else:
				for i in range(n):
					Nums[i] += 1
					count += 1
					s = sum(Nums)
					if s != 0:
						break
	return count
T = int(input())
for i in range(T):
	n = int(input())
	Nums = [int(i) for i in input().split()]
	p = 1
	for i in Nums:
		p = p * i
	if sum(Nums) and p:
		print(0)
	else:
		count = 0
		s = sum(Nums)
		if s == 0:
			count += checkSum(Nums, n)
		if p == 0:
			while p == 0:
				for i in range(n):
					if Nums[i] == 0:
						Nums[i] += 1
						count += 1
					if p != 0:
						break
				p = 1
				for i in Nums:
					p = p * i
		count += checkSum(Nums, n)
		print(count)


q = int(input())
l1 = []
for k in range(q):
	n = int(input())
	c = 0
	s = 0
	l2 = [int(a) for a in input().split()]
	for j in range(n):
		if l2[j] == 0:
			c += 1
			s += 1
		else:
			s += l2[j]
	if s == 0:
		c += 1
	l1.append(c)
for i in range(q):
	print(l1[i])


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = 0
	for i in range(n):
		if a[i] == 0:
			c += 1
			a[i] += 1
	if c == 0:
		b = sum(a)
		if b == 0:
			print(1)
		else:
			print(0)
	else:
		b = sum(a)
		if b == 0:
			print(c + 1)
		else:
			print(c)


cases = int(input())
for i in range(cases):
	line1 = int(input())
	line2 = input().split(' ')
	arr = []
	for a in line2:
		arr.append(int(a))
	moves = 0
	for b in range(len(arr)):
		ele = arr[b]
		if ele == 0:
			arr[b] = 1
			moves += 1
	if sum(arr) == 0:
		moves += 1
		print(moves)
	else:
		print(moves)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	c = 0
	if 0 not in a:
		if sum(a) == 0:
			print(1)
		else:
			print(0)
	elif 0 in a:
		k = a.count(0)
		if k + sum(a) != 0:
			print(k)
		else:
			print(k + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	zeroes = 0
	s = 0
	for i in a:
		if i == 0:
			zeroes += 1
		s += i
	s = s + zeroes
	if s == 0:
		zeroes += 1
	print(zeroes)


import sys
read = lambda : list(map(int, sys.stdin.readline().strip().split()))
for _ in range(int(input())):
	n = int(input())
	a = read()
	s = 0
	count = 0
	for i in a:
		s += i
		count += i == 0
	print([count, count + 1][s + count == 0])


t = int(input())
answers = []
for ti in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	zeros = 0
	for i in range(len(arr)):
		if arr[i] > 0:
			break
		if arr[i] == 0:
			arr[i] += 1
			zeros += 1
	if sum(arr) == 0:
		answers.append(zeros + 1)
	else:
		answers.append(zeros)
for a in answers:
	print(a)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	(s, p) = (0, 1)
	for i in arr:
		s += i
		p *= i
	if p != 0 and s != 0:
		print(0)
	elif p == 0 and s != 0:
		k = arr.count(0)
		print(k + 1 if k + s == 0 else k)
	elif p != 0 and s == 0:
		print(1)
	else:
		print(arr.count(0))


I = input
exec(int(I()) * 'I();a=[*map(int,I().split())];s=a.count(0);print(s+(s+sum(a)==0));')


t = int(input())
for case in range(t):
	n = int(input())
	a = [int(s) for s in input().split(' ')]
	count = a.count(0)
	if count + sum(a) == 0:
		count += 1
	print(count)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split(' ')))
	sumResult = 0
	zeros = 0
	for i in range(len(l)):
		if l[i] == 0:
			l[i] += 1
			zeros += 1
	sumResult = sum(l)
	if sumResult == 0:
		zeros += 1
		print(zeros)
	else:
		print(zeros)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = sum(a)
	prod = 1
	for i in a:
		prod = prod * i
	z = a.count(0)
	if s != 0 and prod != 0:
		print(0)
	elif s == 0 and prod != 0:
		print(1)
	else:
		u = 0
		for i in a:
			if i != 0:
				u += i
		if u < 0:
			if z == abs(u):
				z = z + 1
		print(z)


for q in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s = sum(l)
	a = l.count(0)
	if a > 0 and s == -a:
		print(a + 1)
	elif a > 0 and s != -a:
		print(a)
	elif s == 0:
		print(1)
	else:
		print(0)


for i in range(int(input())):
	input()
	numzeros = 0
	total = 0
	for _ in input().split():
		if not int(_):
			numzeros += 1
		total += int(_)
	print(numzeros + (1 if numzeros + total == 0 else 0))


n = int(input())
for i in range(n):
	x = int(input())
	total = 0
	l = list(map(int, input().split()))
	if l.count(0) != 0:
		total += l.count(0)
	while sum(l) + total == 0:
		total += 1
	print(total)


for _ in [*open(0)][2::2]:
	arr = list(map(int, _.split()))
	print(arr.count(0) + [0, 1][sum(arr) + arr.count(0) == 0])


t = int(input())
sizes = []
elements = []
temp = []
val = 0
sum = 0
for i in range(t):
	sizes.append(int(input()))
	temp = input().split()
	elements.append(temp)
	temp = []
for i in range(t):
	for j in range(sizes[i]):
		if elements[i][j] == '0':
			elements[i][j] = '1'
			val += 1
		sum += int(elements[i][j])
	if sum == 0:
		val += 1
	print(val)
	val = 0
	sum = 0


import sys
import math
CASE = 1
rla = ''

def solve():
	n = int(input())
	li = [int(i) for i in input().split()]
	m = sum(li)
	cnt = 0
	for i in li:
		if i == 0:
			cnt += 1
	print(cnt + (m + cnt == 0))
while True:
	rla = sys.stdin.readline()
	cases = 1
	if not rla:
		break
	if (rla == '\n') | (rla == ''):
		continue
	if CASE == 1:
		cases = int(rla)
	for cas in range(cases):
		solve()


for _ in range(int(input())):
	n = int(input())
	c = 0
	l = list(map(int, input().split()))
	a = l.count(0)
	if sum(l) == 0:
		if a == 0:
			while sum(l) == 0:
				l[0] += 1
				c = c + 1
		else:
			c = a
	else:
		for i in range(len(l)):
			if l[i] == 0:
				l[i] += 1
				c += 1
		if sum(l) == 0:
			while sum(l) == 0:
				l[0] += 1
				c += 1
	print(c)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	cnt = a.count(0)
	if sum(a) == -cnt:
		cnt += 1
	print(cnt)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ctr = l.count(0)
	if ctr > 0:
		for i in range(len(l)):
			if l[i] == 0:
				l[i] = 1
	if sum(l) == 0:
		print(ctr + 1)
	else:
		print(ctr)


def prod(xs):
	ans = 1
	for x in xs:
		ans *= x
	return ans

def main(xs):
	ans = 0
	if prod(xs) == 0:
		for (i, x) in enumerate(xs):
			if x == 0:
				xs[i] = x + 1
				ans += 1
	if sum(xs) == 0:
		for (i, x) in enumerate(xs):
			if x != -1:
				xs[i] = x + 1
				ans += 1
				break
	if sum(xs) == 0:
		for (i, x) in enumerate(xs):
			if x != -1:
				xs[i] = x + 2
				ans += 2
				break
	return ans
t = int(input())
for _ in range(t):
	n = int(input())
	xs = [int(x) for x in input().split()]
	print(main(xs))


from itertools import permutations
import math
import sys
t = int(input())
for i in range(0, t):
	n = int(input())
	a = input().split(' ')
	ans = 0
	s = 0
	for i in range(0, n):
		a[i] = int(a[i])
		if a[i] == 0:
			a[i] = a[i] + 1
			ans = ans + 1
		s = s + a[i]
	if s == 0:
		ans = ans + 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	zeros = a.count(0)
	add = sum(a)
	ans = zeros
	add += zeros
	if add == 0:
		print(ans + 1)
	else:
		print(ans)


def solve():
	n = int(input())
	m = list(map(int, input().split()))
	zeroes = 0
	summ = 0
	for i in m:
		summ += i
		zeroes += i == 0
	ans = zeroes
	ans += zeroes + summ == 0
	print(ans)
t = int(input())
while t:
	solve()
	t -= 1


test_cases = int(input())
for _ in range(test_cases):
	n = int(input())
	a = list(map(int, input().split()))
	zeros = [1 if x == 0 else 0 for x in a]
	find_zeros = sum(zeros)
	sum_a = sum(a)
	if find_zeros > 0:
		sum_a += find_zeros
		if sum_a == 0:
			print(1 + find_zeros)
		else:
			print(find_zeros)
	elif sum_a == 0:
		print(1)
	else:
		print(0)


t = int(input())
for i in range(t):
	cnt = 0
	plus = 0
	minus = 0
	n = int(input())
	a = [int(j) for j in input().split()]
	for k in range(n):
		if a[k] == 0:
			cnt += 1
			a[k] += 1
			plus += a[k]
		elif a[k] > 0:
			plus += a[k]
		elif a[k] < 0:
			minus += a[k]
	if plus + minus == 0:
		cnt += 1
	print(cnt)


test_cases = int(input())
for i in range(test_cases):
	size = int(input())
	arr = list(map(int, input().split(' ')))
	add = 0
	elems_total = sum(arr)
	zeros = arr.count(0)
	if zeros > 0:
		add += zeros
		elems_total += zeros
	if elems_total == 0:
		add += 1
	print(add)


x = int(input())
for i in range(0, x):
	n = int(input())
	m = list(map(int, input().split()))[:n]
	k = sum(m)
	b = m.count(0)
	if k + b == 0:
		print(b + 1)
	else:
		print(b)


import sys
reader = (line.rstrip() for line in sys.stdin)
input = reader.__next__
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ctr = 0
	sm = sum(a)
	for val in a:
		if val == 0:
			ctr += 1
	if sm + ctr == 0:
		ctr += 1
	print(ctr)


for i in range(int(input())):
	n = input()
	l = list(map(int, input().split()))
	c = l.count(0)
	l = list(filter(lambda p: p != 0, l))
	if c + sum(l) == 0:
		print(c + 1)
	else:
		print(c)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	totalSum = 0
	zeroCount = 0
	for item in input().split():
		item = int(item)
		totalSum += item
		if item == 0:
			zeroCount += 1
			totalSum += 1
	print(zeroCount + (1 if totalSum == 0 else 0))


t = int(input())
for k in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	c = 0
	s = 0
	for x in a:
		if x == 0:
			c += 1
		else:
			s += x
	s += c
	if s == 0:
		c += 1
	print(c)


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c = 0
	y = sum(l)
	x = l.count(0)
	if x != 0:
		c += x
		if y + x == 0:
			c += 1
	elif y == 0:
		c += 1
	print(c)


def f(a):
	res = 0
	for i in range(len(a)):
		if a[i] == 0:
			a[i] += 1
			res += 1
	if sum(a) == 0:
		res += 1
	return res
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print(f(a))


I = input
for t in [0] * int(I()):
	n = int(I())
	a = sorted(map(int, I().split()))
	c = 0
	for i in range(n):
		if a[i] == 0:
			a[i] = a[i] + 1
			c += 1
	while sum(a) == 0:
		c += 1
		a[n - 1] += 1
	print(c)


t = int(input())
for q in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	sumN = 0
	pN = 1
	zero = 0
	a.sort()
	for i in range(n):
		sumN += a[i]
		pN *= a[i]
		if a[i] == 0:
			zero += 1
	if sumN != 0 and pN != 0:
		print(0)
		continue
	else:
		sumN += zero
		if sumN == 0:
			print(1 + zero)
		else:
			print(zero)


t = int(input())
for i in range(t):
	n = int(input())
	s = 0
	k = 0
	for i1 in input().split():
		s += int(i1)
		if int(i1) == 0:
			k += 1
	if s + k == 0:
		k += 1
	print(k)


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		array = [int(x) for x in input().strip().split()]
		zeros = 0
		sum_ = sum(array)
		for x in array:
			if x == 0:
				zeros += 1
		if zeros + sum_ == 0:
			zeros += 1
		print(zeros)

def __starting_point():
	main()
__starting_point()


for i in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	p = b.count(0)
	q = min(b)
	r = sum(b)
	if p == 0 and r != 0:
		print(0)
	else:
		z = p
		r += p
		if r == 0:
			z += 1
		print(z)


from _collections import OrderedDict
t = int(input())
while t:
	t -= 1
	n = int(input())
	mas = [int(i) for i in input().split()]
	c0 = mas.count(0)
	if sum(mas) + c0:
		print(c0)
	else:
		print(c0 + 1)


t = int(input())
for j in range(t):
	n = int(input())
	l = input().split(' ')
	c = 0
	for i in range(n):
		l[i] = int(l[i])
	for i in range(n):
		if l[i] == 0:
			l[i] = l[i] + 1
			c = c + 1
	if sum(l) == 0:
		c = c + 1
	print(c)


for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	if sum(lis) != 0 and 0 not in lis:
		print(0)
	elif sum(lis) != 0 and 0 in lis:
		zero = lis.count(0)
		if sum(lis) + zero != 0:
			print(zero)
		else:
			print(zero + 1)
	elif sum(lis) == 0 and 0 in lis:
		zero = lis.count(0)
		if sum(lis) + zero != 0:
			print(zero)
		else:
			print(zero + 1)
	elif sum(lis) == 0 and 0 not in lis:
		print(1)


x = int(input())
l = []
for i in range(x):
	y = int(input())
	l = list(map(int, input().split()))
	s = 0
	h = 0
	for j in range(len(l)):
		if l[j] == 0:
			s += 1
			l[j] = 1
	if sum(l) == 0:
		h += 1
	print(h + s)


t = int(input())
for i in range(0, t):
	for b in range(0, 1):
		n = int(input())
		l = []
		l = list(map(int, input().split()))
		c = 0
		mu = l[0]
		for g in range(1, n):
			mu = mu * l[g]
		if sum(l) != 0 and mu != 0:
			print(c)
			break
		else:
			for k in range(0, n):
				if l[k] == 0:
					l[k] = l[k] + 1
					c = c + 1
			m = l[0]
			for i in range(1, n):
				m = m * l[i]
			if sum(l) != 0 and m != 0:
				print(c)
				break
			else:
				for j in range(0, n):
					l[j] = l[j] + 1
					c = c + 1
					if sum(l) != 0 and m != 0:
						print(c)
						break


t = int(input())
for i in range(t):
	x = int(input())
	l = list(map(int, input().split()))
	s = sum(l)
	z = 0
	for i in range(x):
		if l[i - 1] == 0:
			z += 1
	print(z + (s + z == 0))


def check(arr):
	sum = 0
	prod = 1
	for i in arr:
		sum += i
		prod *= i
	if sum != 0 and prod != 0:
		return True
	return False
t = int(input())
for i in range(t):
	t -= 1
	n = int(input())
	sum = 0
	prod = 1
	arr = []
	x = input()
	arr = x.split(' ')
	arr = [int(i) for i in arr]
	if sum != 0 and prod != 0:
		print(0)
	else:
		result = 0
		indecies = [i for (i, e) in enumerate(arr) if e == 0]
		if len(indecies) != 0:
			for j in indecies:
				arr[j] += 1
				result += 1
		arr.sort(reverse=True)
		while check(arr) == False:
			arr[0] += 1
			result += 1
		print(result)


from sys import stdin, stdout
t = int(stdin.readline())
for case in range(t):
	n = int(stdin.readline())
	ary = list(map(int, stdin.readline().split()))
	moves = 0
	for i in range(n):
		if ary[i] == 0:
			ary[i] = 1
			moves += 1
	s = sum(ary)
	if s == 0:
		moves += 1
	stdout.write('{}\n'.format(moves))


t = int(input())
for i in range(t):
	n = int(input())
	ar = list(map(int, input().split()))
	sums = sum(ar)
	zero = 0
	neg1 = 0
	for i in ar:
		if i == 0:
			zero += 1
		if i == -1:
			neg1 += 1
	good = n - zero - neg1
	if zero == 0 and sums != 0:
		print(0)
	elif zero > 0:
		if zero != -1 * sums:
			print(zero)
		elif zero == -1 * sums:
			if good == 0:
				print(zero + 1)
			else:
				print(zero + 1)
	elif zero == 0 and sums == 0:
		print(1)


def main():
	for _ in range(int(input())):
		m = input()
		n = [int(i) for i in input().split()]
		ans = 0
		while 0 in n:
			n[n.index(0)] = 1
			ans += 1
		if sum(n) == 0:
			ans += 1
		print(ans)
main()


s = int(input())
for i in range(s):
	sum = 0
	count1 = 0
	b = int(input())
	c = list(map(int, input().split()))
	count1 = count1 + c.count(0)
	c = [1 if x == 0 else x for x in c]
	for i in c:
		sum = i + sum
	if sum == 0:
		count1 = count1 + 1
	else:
		c = 'a'
	print(count1)


n = int(input())
for i in range(n):
	x = int(input())
	y = list(map(int, input().split()))
	p = 1
	for i in range(len(y)):
		p = p * y[i]
	if sum(y) == 0 and p != 0:
		print(1)
	if sum(y) == 0 and p == 0:
		print(y.count(0))
	if sum(y) != 0 and p == 0:
		x = y.count(0)
		y.append(x)
		if sum(y) == 0:
			print(1 + x)
		if sum(y) != 0:
			print(x)
	if sum(y) != 0 and p != 0:
		print(0)


t = int(input())
s = []
for kjfuh in range(0, t):
	n = int(input())
	x = input()
	xx = x.split()
	g = 0
	if '0' in xx:
		d = xx.count('0')
	u = 0
	for i in xx:
		u += int(i)
	if '0' in xx:
		if u != -d:
			g += d
		else:
			g += d + 1
	elif u == 0:
		g += 1
	s.append(g)
for i in s:
	print(i)


for _ in range(int(input())):
	N = int(input())
	A = list(map(int, input().split()))
	c = A.count(0)
	a = sum(A) + c
	if a == 0:
		print(c + 1)
	else:
		print(c)


def main():
	t = int(input())
	while t:
		n = input()
		array = list(map(int, input().split()))
		cnt0 = sum([1 if i == 0 else 0 for i in array])
		s = sum(array)
		s = s + cnt0
		if s == 0:
			cnt0 = cnt0 + 1
		print(cnt0)
		t = t - 1
main()


import sys
stdin = sys.stdin
stdout = sys.stdout
test = int(stdin.readline())
for t in range(test):
	n = int(stdin.readline())
	arr = [int(_) for _ in stdin.readline().split()]
	ans = 0
	for i in range(len(arr)):
		if arr[i] == 0:
			ans += 1
			arr[i] += 1
	current_sum = sum(arr)
	if current_sum == 0:
		maxi = max(arr)
		mini = min(arr)
		if maxi == -1 and mini == -1:
			ans += 2
		else:
			ans += 1
	stdout.write(f'{ans}\n')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = 0
	count = 0
	for x in a:
		if not x:
			count += 1
		s += x
	print(count + (1 if s + count == 0 else 0))


import math as mt
import sys, string, bisect
input = sys.stdin.readline
import random
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
t = I()
for _ in range(t):
	n = I()
	l = L()
	s = sum(l)
	z = l.count(0)
	s += z
	if s == 0:
		print(z + 1)
	else:
		print(z)


from operator import mul
from functools import reduce
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	s = sum(l)
	prod = reduce(mul, l, 1)
	if s == 0 or prod == 0:
		m = l.count(0)
		if m > 0:
			k = [i for (i, x) in enumerate(l) if x == 0]
			for i in k:
				l[i] = 1
			s = sum(l)
			if s != 0:
				print(len(k))
			else:
				print(len(k) + 1)
		else:
			print(1)
	else:
		print(0)


t = int(input())
for _ in range(t):
	n = int(input())
	li = list(map(int, input().split()))
	zcount = 0
	sum = 0
	for i in li:
		if i == 0:
			zcount = zcount + 1
		sum = sum + i
	if sum != 0 and zcount == 0:
		print(0)
		continue
	ans = zcount
	sum = sum + zcount
	if sum == 0:
		ans = ans + 1
	print(ans)


def main():
	t = int(input().strip())
	for _ in range(t):
		n = int(input().strip())
		A = [int(s) for s in input().strip().split()]
		s = sum(A)
		z = A.count(0)
		result = z + (s + z == 0)
		print(result)
main()


import math
t = int(input())
list = []
for x in range(1, t + 1):
	templist = []
	l = int(input())
	c = 0
	templist = input()
	templist = templist.split()
	for n in range(0, l):
		templist[n] = int(templist[n])
		if templist[n] == 0:
			templist[n] = 1
			c += 1
	s = 0
	s = int(s)
	for n in range(0, l):
		templist[n] = int(templist[n])
		s += templist[n]
	if s == 0:
		templist.remove(max(templist))
		templist.append(1 + max(templist))
		c += 1
	list.append(c)
for n in list:
	print(n)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().strip().split()))
	s = 0
	e = 0
	for j in range(n):
		if a[j] == 0:
			s = s + 1
			a[j] = 1
			e = 1
	if sum(a) == 0:
		print(s + 1)
	else:
		print(s)


f = int(input())
for q in range(f):
	n = int(input())
	a = list(map(int, input().split()))
	x = a.count(0)
	print(x + int(-1 * sum(a) == x))


numTestcases = int(input())
for i in range(numTestcases):
	n = int(input())
	a = list(map(int, input().split(' ')))
	changes = a.count(0)
	total = changes + sum(a)
	if total == 0:
		changes += 1
	print(changes)


t = int(input())
while t > 0:
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	sum_arr = 0
	prod_arr = 1
	count = 0
	su = 0
	for i in range(0, n):
		sum_arr += arr[i]
		prod_arr = prod_arr * arr[i]
	if prod_arr == 0:
		for i in range(0, n):
			if arr[i] == 0:
				arr[i] += 1
				count += 1
		for i in range(0, n):
			su += arr[i]
		if su == 0:
			maxEle = arr[n - 1]
			if maxEle == -1:
				secondMaxEle = arr[0]
				if secondMaxEle == -1:
					count += 2
				else:
					count += 1
			else:
				count += 1
	elif prod_arr != 0 and sum_arr == 0:
		maxEle = arr[n - 1]
		if maxEle == -1:
			secondMaxEle = arr[0]
			if secondMaxEle == -1:
				count += 2
			else:
				count += 1
		else:
			count += 1
	print(count)
	t = t - 1


a = int(input())
for i in range(a):
	b = int(input())
	c = list(map(int, input().split()))
	zero = c.count(0)
	for (n, i) in enumerate(c):
		if i == 0:
			c[n] = 1
	su = sum(c)
	if su == 0:
		print(zero + 1)
	else:
		print(zero)


import sys
from pprint import pprint
if not 'DEBUG' in globals():
	readline = sys.stdin.readline

def read(map_func):
	return map_func(readline().rstrip())

def reads(map_func):
	return list(map(map_func, readline().rstrip().split()))

def readint():
	return read(int)

def readints():
	return reads(int)

def readcol(n):
	return [readint() for _ in range(n)]

def readmat(n):
	return [readints() for _ in range(n)]

def makemat(n, m, v):
	return [[v for _ in range(n)] for _ in range(m)]

def zeromat(n, m=None):
	return makemat(n, m if m else n, 0)

def listmat(n, m=None):
	return [[[] for _ in range(n)] for _ in range(m if m else n)]

def crosslist(y, x, n=None, m=None):
	return [(p, q) for (p, q) in [(y, x + 1), (y - 1, x), (y, x - 1), (y + 1, x)] if (n == None or 0 <= p < n) and (m == None or 0 <= q < m)]

def roundlist(y, x, n=None, m=None):
	return [(p, q) for (p, q) in [(y, x + 1), (y - 1, x + 1), (y - 1, x), (y - 1, x - 1), (y, x - 1), (y + 1, x - 1), (y + 1, x), (y + 1, x + 1)] if (n == None or 0 <= p < n) and (m == None or 0 <= q < m)]

def log(obj):
	pprint(obj) if 'DEBUG' in globals() else None
T = readint()
for t in range(T):
	N = readint()
	A = readints()
	c = A.count(0)
	s = sum(A) + c
	if s == 0:
		print(c + 1)
	else:
		print(c)


t = int(input())
for i in range(t):
	n = int(input())
	z = list(map(int, input().split()))
	l = z.count(0)
	for i in range(n):
		if z[i] == 0:
			z[i] = 1
	k = sum(z)
	if k == 0:
		print(l + 1)
	else:
		print(l)


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


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = arr.count(0)
	sum_arr = sum(arr) + ans
	if sum_arr == 0:
		ans += 1
	print(ans)


query = int(input())
for _ in range(query):
	n = int(input())
	lt = list(map(int, input().split()))
	s = 0
	m = 1
	c = 0
	for i in range(n):
		if lt[i] == 0:
			c += 1
			s += 1
		else:
			s += lt[i]
	if s == 0:
		c += 1
	print(c)


my_value = []
for i in range(int(input())):
	num = int(input())
	lis = [int(x) for x in input().split()]
	count = 0
	for i in lis:
		if i == 0:
			count += 1
	if sum(lis) + count == 0:
		count += 1
	my_value.append(count)
for i in my_value:
	print(i)


cases = int(input())
for i in range(cases):
	_ = input()
	L = map(int, input().split())
	s = 0
	z = 0
	for e in L:
		s += e
		if e == 0:
			z += 1
	if s + z == 0:
		z += 1
	print(z)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	zeros = []
	s = sum(a)
	p = 1
	ans = 0
	for i in range(n):
		if a[i] == 0:
			zeros.append(i)
		p *= a[i]
	if s != 0 and p != 0:
		print(0)
		continue
	if p == 0:
		for i in range(len(zeros)):
			a[zeros[i]] = 1
		ans += len(zeros)
	s = sum(a)
	if s == 0:
		ans += 1
	print(ans)


import sys
T = int(sys.stdin.readline().strip())
for t in range(0, T):
	n = int(sys.stdin.readline().strip())
	a = list(map(int, sys.stdin.readline().strip().split()))
	ans = 0
	for i in range(0, n):
		if a[i] == 0:
			a[i] = a[i] + 1
			ans = ans + 1
	if sum(a) == 0:
		print(ans + 1)
	else:
		print(ans)


n = int(input())
for i in range(n):
	m = int(input())
	l = list(map(int, input().split()))
	s = sum(l)
	o = l.count(0)
	if o > 0:
		s += o
	if s == 0:
		print(o + 1)
	else:
		print(o)


for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	prod = 1
	s = 0
	ans = 0
	for i in range(n):
		if arr[i] == 0:
			ans += 1
			arr[i] += 1
		s += arr[i]
		prod *= arr[i]
	if s == 0:
		ans += 1
	print(ans)


t = int(input())
for t in range(t):
	n = int(input())
	ara = list(map(int, input().split()))
	total = sum(ara)
	zero = ara.count(0)
	if total + zero == 0:
		print(zero + 1)
	else:
		print(zero)


def check_sum(array):
	total = 0
	for i in array:
		total += int(i)
	if total == 0:
		return False
	else:
		return True

def check_product(array):
	total = 1
	for i in array:
		total = total * int(i)
	if total == 0:
		return False
	else:
		return True

def non_zero():
	cases = int(input())
	matrix = []
	for i in range(cases):
		number_input = int(input())
		matrix.append(input().split())
	for i in range(len(matrix)):
		steps = 0
		while True:
			zero = False
			if check_sum(matrix[i]) and check_product(matrix[i]):
				print(steps)
				break
			for j in range(len(matrix[i])):
				if int(matrix[i][j]) == 0:
					matrix[i][j] = int(matrix[i][j]) + 1
					steps += 1
					zero = True
			if zero:
				if check_sum(matrix[i]) and check_product(matrix[i]):
					print(steps)
					break
			elif int(matrix[i][0]) > 0:
				matrix[i][0] = int(matrix[i][0]) + 1
				steps += 1
			else:
				matrix[i][0] = int(matrix[i][0]) - 1
				steps += 1
non_zero()


t = int(input())
for i in range(t):
	x = 0
	s = 0
	l = 0
	n = int(input())
	for j in input().split():
		if j == '0':
			x += 1
		else:
			s += int(j)
	l = s + x
	if l == 0:
		print(x + 1)
	else:
		print(x)


test = int(input())
for i in range(test):
	number = int(input())
	values = list(map(int, input().split()))
	(c, z) = (0, 0)
	if 0 in values:
		for i in values:
			if i == 0:
				z += 1
		c += z
		if sum(values) == -1 * z:
			c += 1
	elif sum(values) == 0:
		c += 1
		if 0 in values:
			c += 1
	print(c)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	zcount = arr.count(0)
	ans = zcount
	for i in range(len(arr)):
		if not arr[i]:
			arr[i] += 1
	s = sum(arr)
	if not s:
		ans += 1
	print(ans)


import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	t = 0
	while True:
		if 0 in a:
			a[a.index(0)] += 1
		elif sum(a) == 0:
			a[a.index(max(a))] += 1
		else:
			break
		t += 1
	print(t)


import sys
import os
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
mod = 10 ** 9 + 7

def lcm(x, y):
	return x * y / gcd(x, y)

def fact(x, mod=mod):
	ans = 1
	for i in range(1, x + 1):
		ans = ans * i % mod
	return ans

def arr2D(n, m, default=0):
	lst = []
	for i in range(n):
		temp = [default] * m
		lst.append(temp)
	return lst

def sortDictV(x):
	return {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}

def solve(n, lst):
	cnt = 0
	summ = sum(lst)
	for i in lst:
		if i == 0:
			cnt += 1
	if summ + cnt == 0:
		return cnt + 1
	return cnt
for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	print(solve(n, lst))


for i in range(int(input())):
	x = int(input())
	n = list(map(int, input().split()))
	c = n.count(0)
	print(c + (sum(n) + c == 0))


ans = []
for t in range(int(input())):
	n = int(input())
	nums = [int(i) for i in input().split()]
	zeros = 0
	s = 0
	for i in nums:
		s += i
		if i == 0:
			zeros += 1
	a = zeros
	if s + a == 0:
		a += 1
	ans.append(str(a))
print('\n'.join(ans))


from array import array
test = int(input())
for i in range(test):
	len = int(input())
	ori = input().split()
	step = 0
	step += ori.count('0')
	sum = 0
	for each in ori:
		sum += int(each)
	sum += step
	if sum == 0:
		step += 1
	print(step)


t = int(input())
ans = []
cnt = 0
sm = 0
for i in range(t):
	n = int(input())
	ls = list(map(int, input().split()))
	for j in range(len(ls)):
		if ls[j] == 0:
			cnt = cnt + 1
			ls[j] = 1
		sm = sm + ls[j]
	if sm != 0:
		ans.append(cnt)
	else:
		ans.append(cnt + 1)
	cnt = 0
	sm = 0
for i in range(t):
	print(ans[i])


for _ in range(int(input())):
	n = int(input())
	array = list(map(int, input().split()))
	c = 0
	for i in range(n):
		if array[i] == 0:
			array[i] = 1
			c += 1
	s = sum(array)
	if s != 0:
		print(c)
	else:
		print(c + 1)


n = int(input())
for t in range(n):
	x = int(input())
	sc = list(map(int, input().split()))
	cont = 0
	while 0 in sc:
		sc[sc.index(0)] = 1
		cont += 1
	while sum(sc) == 0:
		sc[sc.index(max(sc))] += 1
		cont += 1
	print(cont)


import math
import operator

def AcDegaYe():
	n = int(input())
	li = list(map(int, input().split()))
	x = 1
	for i in li:
		x *= i
	if sum(li) != 0 and x != 0:
		print(0)
	elif sum(li) == 0 and x != 0:
		print(1)
	else:
		c = 0
		for i in range(n):
			if li[i] == 0:
				li[i] = 1
				c += 1
		if sum(li) != 0:
			print(c)
		else:
			print(c + 1)
t = int(input())
for _ in range(t):
	AcDegaYe()


t = int(input())
for _ in range(t):
	x = int(input())
	a = [int(i) for i in input().split()]
	s = sum(a)
	b = a.count(0)
	if s + b != 0:
		print(b)
	else:
		print(b + 1)


n = int(input())
for i in range(n):
	q = int(input())
	l = list(map(int, input().split()))
	s = 0
	d = 0
	for j in range(q):
		s += l[j]
		if l[j] == 0:
			d += 1
			l[j] += 1
			s += 1
	if s == 0:
		d += 1
	print(d)


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	q = 0
	s = 0
	for i in range(n):
		s += a[i]
		if a[i] == 0:
			q += 1
	if s + q == 0:
		print(q + 1)
	else:
		print(q)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s = sum(l)
	prod = 1
	for i in l:
		prod *= i
	zero = l.count(0)
	if s != 0 and prod != 0:
		print(0)
	elif s == 0 and prod != 0:
		print(1)
	elif prod == 0:
		ans = zero
		s += zero
		if s == 0:
			ans += 1
		print(ans)


for t in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	cnt = 0
	cnt = arr.count(0)
	su = sum(arr) + cnt
	if su == 0:
		print(cnt + 1)
	else:
		print(cnt)


def main():

	def solve():
		n = int(input())
		aa = [int(a) for a in input().split()]
		count = 0
		sum = 0
		for a in aa:
			sum += a
			if a == 0:
				count += 1
				sum += 1
		if sum == 0:
			count += 1
		print(count)
	q = int(input())
	for _ in range(q):
		solve()
main()


for i in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	c = 0
	for i in range(n):
		if x[i] == 0:
			x[i] = x[i] + 1
			c = c + 1
	tot = sum(x)
	if tot != 0:
		print(c)
	else:
		print(c + 1)


t = int(input())
for h in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	c = 0
	r = 0
	k = 0
	for i in range(n):
		if l[i] == 0:
			l[i] = l[i] + 1
			k = k + l[i]
			c = c + 1
		else:
			k = k + l[i]
		if l[i] == -1:
			r = r + 1
	if k == 0:
		c = c + 1
	print(c)


t = int(input())
if not 1 <= t <= 10 ** 3:
	exit()
results = []
for i in range(t):
	n = int(input())
	if not 1 <= n <= 100:
		exit()
	a = [int(item) for item in input().split(' ') if -100 <= int(item) <= 100]
	if len(a) != n:
		exit()
	summation = sum(a)
	zeros = a.count(0)
	results.append(zeros + 1 if summation + zeros == 0 else zeros)
[print(item) for item in results]


def binarySearch(arr, x):
	l = 0
	r = len(arr) - 1
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def js(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] <= x:
			ans = m
			l = m + 1
		else:
			r = m - 1
	return ans

def jg(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] >= x:
			ans = m
			r = m - 1
		else:
			l = m + 1
	return ans
from math import *

def ceil(a, b):
	if a % b == 0:
		return int(a / b)
	else:
		return a // b + 1
for i in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	z = ar.count(0)
	s = sum(ar)
	if s == 0:
		if z == 0:
			print(1)
		else:
			print(z)
	elif s != 0:
		if z == 0:
			print(0)
		elif z + s == 0:
			print(z + 1)
		else:
			print(z)


for _ in range(int(input())):
	n = int(input())
	array = list(map(int, input().strip().split()))
	zeros = array.count(0)
	sumo = sum(array)
	if sumo + zeros == 0:
		ans = zeros + 1
	else:
		ans = zeros
	print(ans)


for _ in ' ' * int(input()):
	input()
	a = list(map(int, input().split()))
	print(a.count(0) + 1 if sum(a) + a.count(0) == 0 else a.count(0))


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	sum1 = sum(a)
	count0 = 0
	for j in a:
		if j == 0:
			count0 += 1
	if count0 == -sum1:
		print(count0 + 1)
	else:
		print(count0)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	res = sum(a)
	zeros = 0
	count = 0
	for i in a:
		if i == 0:
			zeros += 1
	if res != 0 and zeros == 0:
		print(0)
	else:
		count += zeros
		res += zeros
		if res == 0:
			count += 1
		print(count)


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	numz = len([x for x in a if x == 0])
	if sum(a) == 0 and numz == 0:
		print('1')
	elif sum(a) != 0 and numz == 0:
		print('0')
	elif numz == -sum(a):
		print(numz + 1)
	else:
		print(numz)


for _ in range(int(input())):
	n = int(input())
	a = [int(__) for __ in input().split()]
	ans = 0
	for i in range(n):
		if a[i] == 0:
			a[i] = 1
			ans += 1
	if sum(a) == 0:
		print(ans + 1)
	else:
		print(ans)


a = int(input())
for i in range(a):
	b = int(input())
	c = list(map(int, input().split()))
	pro = 1
	sum = 0
	det = 0
	for i in range(len(c)):
		sum += c[i]
		pro *= c[i]
	if pro == 0:
		for i in range(len(c)):
			if c[i] == 0:
				c[i] += 1
				det += 1
	sum = 0
	pro = 1
	for i in range(len(c)):
		sum += c[i]
		pro *= c[i]
	k = 0
	while sum == 0:
		max = -999999999
		for i in range(len(c)):
			if c[i] > max:
				max = c[i]
				k = i
			c[k] += 1
		det += 1
		for i in range(len(c)):
			sum += c[i]
	print(det)


def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		i = a.count(0)
		if sum(a) + i == 0:
			print(i + 1)
		else:
			print(i)
main()


for _ in range(int(input())):
	n = int(input())
	arr = [int(k) for k in input().split()]
	c = 0
	sum = 0
	for i in range(n):
		if arr[i] == 0:
			c += 1
		sum = sum + arr[i]
	if sum + c == 0:
		print(c + 1)
	else:
		print(c)


t = int(input())
for i in range(t):
	a = int(input())
	l = list(map(int, input().split()))
	c = l.count(0)
	if sum(l) + c == 0:
		c += 1
	print(c)


def solve(n, a):
	cnt = 0
	for (i, v) in enumerate(a):
		if v == 0:
			cnt += 1
			a[i] += 1
	su = sum(a)
	cnt += 1 if su == 0 else 0
	print(cnt)

def main():
	tc = int(input())
	for _ in range(tc):
		n = int(input())
		a = [int(x) for x in input().split()]
		solve(n, a)
main()


import sys
input = sys.stdin.readline

def getInt():
	return int(input())

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

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

def getStr():
	return input().strip()
t = getInt()
for i in range(t):
	n = getInt()
	a = getList()
	k0 = 0
	for i in range(n):
		if a[i] == 0:
			k0 += 1
	res = k0
	s = sum(a)
	if k0 == 0 and s == 0:
		res = 1
	if k0 > 0 and s == -k0:
		res = k0 + 1
	print(res)


for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	ref = lis.count(0)
	print(ref + (1 if not sum(lis) + ref else 0))


t = int(input())
while t > 0:
	n = int(input())
	b = 0
	c = 0
	arr = [int(x) for x in input().split()]
	b = arr.count(0)
	c = sum(arr) + b
	if c == 0:
		b += 1
	print(b)
	t -= 1


from sys import stdin
testcase = True
if testcase:
	t = int(stdin.readline())
	while t:
		n = int(stdin.readline())
		a = list(map(int, stdin.readline().split()))
		if sum(a) != 0 and 0 not in a:
			print(0)
		elif sum(a) == 0 and 0 not in a:
			print(1)
		elif 0 in a:
			c = a.count(0)
			for i in range(n):
				if a[i] == 0:
					a[i] += 1
			if sum(a) == 0:
				c += 1
			print(c)
		t -= 1
else:
	n = int(stdin.readline())
	(p, m) = map(int, stdin.readline().split())
	a = list(map(int, stdin.readline().split()))


import sys
from functools import reduce

def solution(arr, n):
	res = 0
	sum_arr = sum(arr)
	if 0 not in arr and sum_arr != 0:
		print(res)
		return
	if 0 in arr:
		res += arr.count(0)
		zeros_idx = [i for i in range(n) if arr[i] == 0]
		for i in zeros_idx:
			arr[i] = 1
	sum_arr = sum(arr)
	if sum_arr == 0:
		res += 1
	print(res)
for line in sys.stdin:
	t = int(line)
	break
p = 1
for line in sys.stdin:
	if p == 1:
		n = int(line)
	else:
		arr = [int(x) for x in line.split()]
		solution(arr, n)
	p *= -1


t = int(input())
while t:
	t -= 1
	n = int(input())
	zero = 0
	sum = 0
	x = list(map(int, input().split()))
	for i in range(n):
		sum += x[i]
		if x[i] == 0:
			zero += 1
	if sum == 0:
		if zero == 0:
			print(1)
		else:
			print(zero)
	elif zero == 0:
		print(0)
	elif zero + sum == 0:
		print(zero + 1)
	else:
		print(zero)


t = int(input())

def product(p):
	n = 1
	for i in p:
		n *= i
	return n
while t != 0:
	n = int(input())
	l = [int(i) for i in input().split()]
	l1 = l.copy()
	if sum(l) != 0 and product(l) != 0:
		print(0)
	else:
		c = 0
		while product(l) == 0:
			if l.count(0) != 0:
				l[l.index(0)] = 1
				c += 1
		while sum(l) == 0:
			l[0] += 1
			c = c + 1
		print(c)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	li = [int(x) for x in input().split()]
	zeroes = li.count(0)
	if sum(li) + zeroes == 0:
		print(zeroes + 1)
	else:
		print(zeroes)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	psum = 0
	nsum = 0
	noz = 0
	ans = 0
	for i in a:
		if i == 0:
			noz += 1
		elif i > 0:
			psum += i
		else:
			nsum += i
	if noz == 0:
		if psum == -nsum:
			ans += 1
	else:
		ans += noz
		if noz + psum == -nsum:
			ans += 1
	print(ans)


for i in range(int(input())):
	q = int(input())
	w = list(map(int, input().split()))
	e = sum(w)
	k = 0
	r = w.count(0)
	if r != 0:
		k += r
		e += r
	if e == 0:
		k += 1
	print(k)


t = int(input().strip())
for _ in range(t):
	n = int(input().strip())
	alist = list(map(int, input().split()))
	sum = 0
	cnt = 0
	for a in alist:
		if a == 0:
			sum += 1
			cnt += 1
		else:
			sum += a
	if sum == 0:
		cnt += 1
	print(cnt)


def multiply(l):
	m = 1
	for x in l:
		m *= x
	return m
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().strip().split()))
	s = 0
	M = multiply(l)
	for j in range(n):
		if l[j] == 0:
			s = s + 1
			l[j] = 1
	for k in range(n):
		if sum(l) == 0:
			s = s + 1
			l.append(1)
	print(s)


t = int(input())
for k in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	if a.count(0) == 0 and sum(a) != 0:
		print('0')
	else:
		c = a.count(0)
		if sum(a) + c == 0:
			print(c + 1)
		else:
			print(c)


from sys import stdin, stdout
T = int(input())
for t in range(T):
	n = int(input())
	a = list(map(int, stdin.readline().split()))
	ans = 0
	sum = 0
	for i in a:
		if i == 0:
			ans += 1
			i += 1
		sum += i
	if sum == 0:
		ans += 1
	print(ans)


for i in range(int(input())):
	input()
	l = list(map(int, input().split()))
	v = l.count(0)
	print(v + (not sum(l) + v))


t = int(input())

def f(l):
	z = 0
	p = 0
	n = 0
	for i in range(0, len(l)):
		if l[i] == 0:
			z += 1
		if l[i] > 0:
			p = p + l[i]
		else:
			n = n + l[i]
	if p + n != 0 and z == 0:
		return 0
	elif p + n == 0 and z != 0:
		x = z
		p = p + z
		return x
	elif p + n == 0 and z == 0:
		if p == 0:
			for i in range(0, len(l)):
				if l[i] != -1:
					return 1
		else:
			return 1
	elif p + n != 0 and z != 0:
		x = z
		p = p + x
		if p + n == 0:
			return x + 1
		else:
			return x
for i in range(0, t):
	n = int(input())
	l = list(map(int, input().split()))
	print(f(l))


def non_zero(n, l):
	c = l.count(0)
	x = c
	s = sum(l) + c
	if s == 0:
		x += 1
	return x
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	result = non_zero(n, l)
	print(result)


a = int(input())
c = []
g = []
for i in range(a):
	c.append(int(input()))
	g.append(list(map(int, input().split())))
for i in range(a):
	k = 0
	m = 0
	for n in range(c[i]):
		if g[i][n] == 0:
			k = k + 1
	for n in range(c[i]):
		m = m + g[i][n]
	if m + k == 0:
		k = k + 1
	print(k)


from sys import stdin, stdout
in1 = int(stdin.readline())
for i in range(in1):
	in2 = int(stdin.readline())
	in3 = stdin.readline().split()
	in3 = list(map(int, in3))
	k = 0
	s = 0
	for j in range(in2):
		if in3[j] == 0:
			s = s + 1
			k = k + 1
		else:
			s = s + in3[j]
	if s == 0:
		k = k + 1
	stdout.write(str(k) + '\n')


N = int(input())
for i in range(N):
	ans = 0
	n = int(input())
	l = list(map(int, input().split(' ')))
	for i in range(n):
		if l[i] == 0:
			l[i] += 1
			ans += 1
	if sum(l) == 0:
		ans += 1
	print(ans)


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ct = 0
	cont = True
	c = Counter(a)
	if 0 in c:
		ct += c[0]
		if sum(a) + ct == 0:
			ct += 1
	elif sum(a) == 0:
		ct += 1
	print(ct)


for _ in range(int(input().strip())):
	n = int(input().strip())
	a = list(map(int, input().strip().split()))
	zero_count = 0
	s = 0
	for i in a:
		if i == 0:
			zero_count += 1
		s += i
	ans = zero_count
	if s + zero_count == 0:
		ans += 1
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	s = sum(l)
	z = l.count(0)
	c = z
	s = s + z
	if s == 0:
		c = c + 1
	print(c)


number = int(input())
for _ in range(number):
	input()
	ans = 0
	u_list = [int(y) for y in input().split()]
	summ = 0
	for i in u_list:
		if not i:
			ans += 1
			summ += 1
		summ += i
	if not summ:
		ans += 1
	print(ans)


def changes(arr):
	chances = 0
	for (i, num) in enumerate(arr):
		if num == 0:
			chances += 1
			arr[i] = 1
	if sum(arr) == 0:
		return chances + 1
	return chances
t = int(input())
for i in range(t):
	n = int(input())
	x = list(map(int, input().rstrip().split()))
	print(changes(x))


from sys import stdin

def main():
	input = lambda : stdin.readline()[:-1]
	T = int(input())
	for _ in [0] * T:
		N = int(input())
		A = list(map(int, input().split()))
		zero = A.count(0)
		sum_ = sum(A)
		if not zero and sum_ != 0:
			ans = 0
		else:
			ans = zero
			sum_ += zero
			if not sum_:
				ans += 1
		print(ans)
main()


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	times = 0
	for j in range(len(a)):
		if a[j] == 0:
			a[j] = 1
			times += 1
	if sum(a) == 0:
		times += 1
	print(times)


n = int(input())
mas = []
for i in range(n):
	m = int(input())
	mn = list(map(int, input().split()))
	h = 0
	for i in range(len(mn)):
		if mn[i] == 0:
			mn[i] = 1
			h = h + 1
	while sum(mn) == 0:
		mn[0] += 1
		h = h + 1
	print(h)


t = int(input())

def countZero(arr):
	cnt = 0
	for val in arr:
		if val == 0:
			cnt += 1
	return cnt
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	cntZero = countZero(arr)
	if sum(arr) + cntZero == 0:
		print(countZero(arr) + 1)
	else:
		print(countZero(arr))


import os
from io import BytesIO, IOBase
import sys
from bisect import bisect_right, bisect_left

def main():
	for _ in range(int(input())):
		m = int(input())
		a = list(map(int, input().split()))
		(z, p, n) = (0, 0, 0)
		for i in range(m):
			if a[i] == 0:
				z += 1
			elif a[i] < 0:
				n += a[i]
			else:
				p += a[i]
		if p + z != abs(n):
			print(z)
		else:
			print(z + 1)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
input = sys.stdin.readline
from collections import Counter as co
for _ in range(int(input().strip())):
	n = int(input().strip())
	arr = list(map(int, input().strip().split()))
	su = sum(arr)
	z = co(arr)[0]
	if su == 0:
		if z == 0:
			print(1)
		else:
			print(z)
	elif z == 0:
		print(0)
	elif z == -su:
		print(z + 1)
	else:
		print(z)


for case in range(int(input())):
	n = int(input())
	series = [int(x) for x in input().split()]
	ans = 0
	ans += series.count(0)
	s = sum(series)
	s += ans
	if s != 0:
		print(ans)
	else:
		print(ans + 1)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	zero = 0
	nn = 0
	pp = 0
	count = 0
	for i in l:
		if i == 0:
			zero += 1
		elif i < 0:
			nn += i
		else:
			pp += i
	pp += zero
	count += zero
	if pp == abs(nn):
		count += 1
	print(count)


t = int(input())
while t > 0:
	n = int(input())
	l = list(map(int, input().split()))
	c = l.count(0)
	if sum(l) + c == 0:
		c += 1
	print(c)
	t -= 1


import sys
sys.setrecursionlimit(10000000)
mod = 10 ** 9 + 7
INF = float('inf')
from sys import stdin
readline = stdin.readline

def readInts():
	return list(map(int, readline().split()))

def readTuples():
	return tuple(map(int, readline().split()))

def I():
	return int(readline())
from collections import Counter
q = I()
for _ in range(q):
	n = I()
	A = readInts()
	SUM = sum(A)
	ans = 0
	C = Counter(A)
	if SUM == 0:
		if C[0]:
			print(C[0])
		else:
			print(1)
	elif SUM > 0:
		if C[0]:
			print(C[0])
		else:
			print(0)
	else:
		SUM = SUM + C[0]
		ans += C[0]
		if SUM == 0:
			ans += 1
		print(ans)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	z = l.count(0)
	print(z + (z + sum(l) == 0))


import math, sys
from collections import defaultdict, Counter, deque
INF = float('inf')

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def isPrime(n):
	if n <= 1:
		return False
	i = 2
	while i ** 2 <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def primeFactors(n):
	factors = []
	i = 2
	while i ** 2 <= n:
		while n % i == 0:
			factors.append(i)
			n //= i
		i += 1
	if n > 1:
		factors.append(n)
	return factors

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

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

def c(n, r):
	return math.factorial(n) / (math.factorial(n - r) * math.factorial(r))

def main():
	n = int(input())
	arr = array()
	ans = 0
	for i in range(n):
		if arr[i] == 0:
			arr[i] += 1
			ans += 1
	pos = 0
	neg = 0
	for i in range(n):
		if arr[i] < 0:
			neg += arr[i]
		else:
			pos += arr[i]
	if pos + neg == 0:
		print(ans + 1)
	else:
		print(ans)
t = int(input())
for _ in range(t):
	main()


cases = int(input())
for i in range(cases):
	size = int(input())
	nums = list(map(int, input().split()))
	num_sum = sum(nums)
	zero_count = nums.count(0)
	result = zero_count
	if num_sum + zero_count == 0:
		result += 1
	print(result)


T = int(input())
for _ in range(T):
	n = int(input())
	arr = [int(x) for x in input().split()]
	zeroes = arr.count(0)
	for i in range(len(arr)):
		if arr[i] == 0:
			arr[i] += 1
	if sum(arr) == 0:
		print(zeroes + 1)
	else:
		print(zeroes)


t = int(input())
while t > 0:
	n = int(input())
	a = [int(i) for i in input().split()]
	k = a.count(0)
	if sum(a) + k == 0:
		k += 1
	print(k)
	t -= 1


import sys
import math
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	neg = 0
	pos = 0
	ans = 0
	for i in range(n):
		if arr[i] == 0:
			ans += 1
			arr[i] = 1
	arr.sort(reverse=True)
	sum = 0
	for i in range(n):
		sum += arr[i]
		if arr[i] < 0:
			neg += 1
		else:
			pos += 1
	arr.sort()
	i = 0
	while sum == 0:
		if arr[i] > 0:
			ans += 1
			sum += 1
		elif arr[i] < -1:
			ans += 1
			sum += 1
		i += 1
	if sum == 0:
		ans += 2
	print(ans)


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		zero = 0
		for j in range(n):
			if a[j] == 0:
				zero += 1
		if sum(a) + zero == 0:
			zero += 1
		print(zero)
main()


def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	cnt = 0
	for i in range(n):
		if not arr[i]:
			arr[i] += 1
			cnt += 1
	if not sum(arr):
		cnt += 1
	return cnt
for _ in range(int(input())):
	print(solve())


for _ in range(int(input())):
	n = int(input())
	ans = 0
	a = [int(i) for i in input().split()]
	ans += a.count(0)
	for i in range(n):
		if a[i] == 0:
			a[i] = 1
	if sum(a) == 0:
		ans += 1
	print(ans)


t = int(input())
for i in range(0, t):
	n = int(input())
	a = [n]
	a = list(map(int, input().split()))

	def zero(b):
		y = 0
		for z in range(0, n):
			if b[z] == 0:
				b[z] = 1
				y += 1
		return y

	def sum(c):
		s = 0
		for u in range(0, n):
			s = s + c[u]
		return s
	x = zero(a)
	sum = sum(a)
	if sum != 0:
		print(x)
	else:
		print(x + 1)


n = int(input())
for i in range(n):
	sum = 0
	m = int(input())
	a = [int(i) for i in input().split()]
	e = a.count(0)
	for j in range(0, len(a)):
		sum = sum + a[j]
	if sum == 0 and e == 0:
		print(1)
	elif sum == 0 and e > 0:
		print(e)
	elif sum != 0 and e == 0:
		print(0)
	else:
		d = sum + e
		if d == 0:
			print(e + 1)
		else:
			print(e)


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	k = 0
	su = 0
	for i in range(n):
		if a[i] == 0:
			a[i] += 1
			k += 1
		su += a[i]
	if su == 0:
		p = 0
		for i in range(n):
			if a[i] != -1:
				a[i] += 1
				k += 1
				p = 1
				break
		if p == 0:
			a[0] += 2
			k += 2
	print(k)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	c = l.count(0)
	x = c
	s = sum(l) + c
	if s == 0:
		x += 1
	else:
		x = x
	print(x)


for i in range(int(input())):
	n = int(input(''))
	l = list(map(int, input().split(' ')))
	print(l.count(0) + (sum(l) + l.count(0) == 0))


t = int(input())
m = 0
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	for i in range(len(a)):
		if a[i] == 0:
			a[i] += 1
			m += 1
		else:
			pass
	b = a
	for i in range(len(b)):
		if sum(b) == 0:
			m += 1
			b[i] += 1
	print(m)
	m = 0


n = int(input())
for i in range(n):
	m = int(input())
	s = 0
	cnt0 = 0
	a = list(map(int, input().split()))
	for j in a:
		s += j
		if j == 0:
			cnt0 += 1
			s += 1
	if s == 0:
		cnt0 += 1
	print(cnt0)


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

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

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

def inputstring():
	return [x for x in input()]

def inputstringnum():
	return [ord(x) - ord('a') for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	n = inputnum()
	a = inputlist()
	zero = 0
	sm = 0
	for i in a:
		sm += i
		if i == 0:
			zero += 1
	if sm + zero == 0:
		zero += 1
	print(zero)


for i in range(int(input())):
	t = int(input())
	lst = list(map(int, input().split()))
	res = lst.count(0)
	tot = sum(lst) + res
	if tot == 0:
		res += 1
	print(res)


t = int(input())
while t > 0:
	n = int(input())
	a_list = list(map(int, input().split()))
	zeros = a_list.count(0)
	sum = 0
	for x in a_list:
		sum += x
	additions = zeros
	sum += additions
	print(additions) if sum != 0 else print(additions + 1)
	t -= 1


n = int(input())
for i in range(n):
	x = int(input())
	a = list(map(int, input().split()))
	cnt = 0
	for i in range(len(a)):
		if a[i] == 0:
			cnt += 1
			a[i] = a[i] + 1
	if sum(a) == 0:
		cnt += 1
	print(cnt)


t = int(input())
while t:
	t -= 1
	n = int(input())
	arr = [int(i) for i in input().split(' ')]
	zero = 0
	non = 0
	add = sum(arr)
	prod = 1
	ans = 0
	for i in arr:
		if i == 0:
			zero += 1
		prod *= i
	if add != 0 and prod != 0:
		print(0)
		continue
	elif add + zero == 0:
		print(zero + 1)
	else:
		print(zero)


num_cases = int(input())
for _ in range(num_cases):
	num_arrays = int(input())
	nums = list(map(int, input().split(' ')))
	total_sum = sum(nums)
	zero_count = len(list(filter(lambda x: x == 0, nums)))
	if zero_count == 0:
		if total_sum == 0:
			print(1)
		else:
			print(0)
	else:
		total_sum += zero_count
		if total_sum != 0:
			print(zero_count)
		else:
			print(zero_count + 1)


t = int(input())
for j in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	currsum = 0
	zc = 0
	for i in range(n):
		if a[i] == 0:
			zc += 1
		currsum += a[i]
	if zc + currsum == 0:
		print(zc + 1)
	elif zc == 0 and sum == 0:
		print(1)
	elif zc > 0:
		print(zc)
	elif zc == 0:
		print(0)


for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	replc = 0
	add = 0
	step = 0
	for i in range(n):
		if lis[i] == 0:
			lis[i] = 1
			step += 1
		add += lis[i]
	if add == 0:
		print(step + 1)
	else:
		print(step)


for s in [*open(0)][2::2]:
	a = list(map(int, s.split()))
	c = 0
	c += a.count(0)
	print(c + (c + sum(a) == 0))


t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	ans = 0
	for a in range(len(A)):
		if A[a] == 0:
			ans += 1
			A[a] = 1
	if sum(A) == 0:
		ans += 1
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	s = sum(arr)
	nc = 0
	for i in range(n):
		if arr[i] == 0:
			nc = nc + 1
	c = 0
	while s == 0 or nc > 0:
		c += 1
		for i in range(n):
			if arr[i] == 0 or arr[i] < 0:
				arr[i] = arr[i] + 1
				break
		s = sum(arr)
		nc = nc - 1
	print(c)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in input().split(' ')]
	result = 0
	for i in range(len(arr)):
		if arr[i] == 0:
			arr[i] = 1
			result += 1
	arr_sum = sum(arr)
	if arr_sum != 0:
		print(result)
	else:
		print(result + 1)


for _ in range(int(input())):
	n = int(input())
	lis = [int(i) for i in input().split()]
	z = lis.count(0)
	s = sum(lis)
	ans = z + (s + z == 0)
	print(ans)


for i in range(int(input())):
	n = int(input())
	n1 = list(map(int, input().split()))
	add = 0
	mul = 0
	for i in range(len(n1)):
		if n1[i] == 0:
			mul = mul + 1
			n1[i] = 1
	for j in n1:
		add = add + j
	if add == 0:
		mul = mul + 1
	print(mul)


t = int(input())
for i in range(t):
	n = int(input())
	S = 0
	P = 1
	l = list(map(int, input().split()))
	STEPS = 0
	for j in range(len(l)):
		if l[j] == 0:
			l[j] += 1
			STEPS += 1
	S = sum(l)
	for j in range(len(l)):
		P *= l[j]
	if S != 0:
		print(STEPS)
	else:
		print(STEPS + 1)


def sp(l):
	(c, s) = (0, 0)
	for i in range(len(l)):
		if l[i] == 0:
			c += 1
			l[i] += 1
	s = sum(l)
	if s == 0:
		c += 1
		for i in l:
			if i != -1:
				i = i + 1
				break
	return c
for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	print(sp(l))


import sys

def func(n):
	zeroes = n.count(0)
	add = sum(n)
	if add == 0 and zeroes == 0:
		return str(1) + '\n'
	elif add + zeroes == 0:
		return str(zeroes + 1) + '\n'
	else:
		return str(zeroes) + '\n'
n = int(sys.stdin.readline())
for i in range(n):
	a = sys.stdin.readline()
	b = map(int, sys.stdin.readline().split())
	sys.stdout.write(func(list(b)))


n = int(input())
for i in range(n):
	m = int(input())
	a = list(map(int, input().split()))
	zeroes = a.count(0)
	summa = sum(a)
	total = zeroes
	if summa + zeroes == 0:
		total += 1
	print(total)


for _ in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	ans = 0
	SUM = sum(s)
	for x in s:
		if x == 0:
			ans += 1
	SUM += ans
	if SUM == 0:
		ans += 1
	print(ans)


for t in range(int(input())):
	a = int(input())
	l = list(map(int, input().split()))
	ans = 0
	z = l.count(0)
	ans += z
	if sum(l) + ans == 0:
		ans += 1
	print(ans)


from collections import Counter

def min_steps(n, arr):
	aux = Counter(arr)
	counter = 0
	counter += aux.get(0) or 0
	if aux.get(1) is None:
		aux[1] = 0
	aux[1] += counter
	if sum([k * v for (k, v) in aux.items()]) == 0:
		counter += 1
	print(counter)
	return
T = int(input().strip())
for t in range(T):
	n = int(input().strip())
	s = input().strip().split(' ')
	arr = list(map(int, s))
	min_steps(n, arr)


n = int(input())
inputs_length = []
inputs = []
for _ in range(n):
	length = int(input())
	inputs_length.append(length)
	origin_input = input().split()
	inputs_tmp = []
	for i in range(length):
		inputs_tmp.append(int(origin_input[i]))
	inputs.append(inputs_tmp)
for intergers in inputs:
	sum = 0
	cnt = 0
	for i in range(len(intergers)):
		if intergers[i] == 0:
			intergers[i] += 1
			cnt += 1
		sum += intergers[i]
	if sum == 0:
		cnt += 1
	print(cnt)


t = int(input())
for q in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	numberoftimes = sum((i == 0 for i in arr))
	arr = [arrm + (arrm == 0) for arrm in arr]
	numberoftimes += int(sum(arr) == 0)
	print(numberoftimes)


t = int(input())
for _ in range(t):
	k = int(input())
	summ = 0
	m = 0
	b = list(map(int, input().split()))
	for i in b:
		if i == 0:
			summ += 1
			m += 1
		else:
			summ += i
	if summ == 0:
		m += 1
	print(m)


t = int(input())
for you in range(t):
	n = int(input())
	l = input().split()
	li = [int(i) for i in l]
	z = sum(li)
	count = 0
	for i in li:
		if i == 0:
			count += 1
	if z == 0:
		print(max(1, count))
	elif z + count != 0:
		print(count)
	else:
		print(count + 1)


import math
for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	ans = 0
	su = 0
	for i in range(n):
		if li[i] == 0:
			li[i] = 1
			ans += 1
		su += li[i]
	if su == 0:
		ans += 1
	print(ans)


t = int(input())
for ygn in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	z = 0
	s = 0
	p = 1
	for i in range(n):
		s += a[i]
		p *= a[i]
		if a[i] == 0:
			z += 1
			a[i] = 1
	if s != 0 and p != 0:
		print(0)
		continue
	if z == 0:
		print(1)
		continue
	if sum(a) != 0:
		print(z)
	else:
		print(z + 1)


import sys
queries = int(sys.stdin.readline())
for query in range(queries):
	n = int(sys.stdin.readline())
	array = sys.stdin.readline().strip().split()
	array = [int(x) for x in array]
	sumElements = sum(array)
	answer = array.count(0)
	if sumElements + answer == 0:
		answer += 1
	print(answer)


for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	a = sum(lis)
	zer = lis.count(0)
	if zer + a > 0:
		print(zer)
	else:
		a += zer
		if a == 0:
			print(zer + 1)
		else:
			print(zer)


t = int(input())
result = []
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	countZero = 0
	sumArr = 0
	for x in arr:
		sumArr += x
		if x == 0:
			countZero += 1
	count = 0
	count += countZero
	sumArr += count
	if sumArr == 0:
		count += 1
	result.append(count)
for x in result:
	print(x)


t = int(input())
for case in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	prod = 1
	for i in arr:
		if i == 0:
			prod = 0
	ans = 0
	if prod == 0:
		for i in range(n):
			if arr[i] == 0:
				arr[i] += 1
				ans += 1
	s = sum(arr)
	neg1 = 0
	not_neg1 = 0
	for i in range(n):
		if arr[i] == -1:
			neg1 += 1
		else:
			not_neg1 += 1
	if s == 0:
		if not_neg1:
			ans += 1
		else:
			ans += 2
	print(ans)


for _ in range(int(input())):
	n = int(input())
	c = 0
	r = list(map(int, input().strip().split()))[:n]
	for i in range(n):
		if not r[i]:
			r[i] = r[i] + 1
			c += 1
	if not sum(r):
		for i in range(n):
			if r[i] > 0:
				r[i] += 1
				c += 1
				break
	print(c)


queries = int(input())
for _ in range(queries):
	_ = input()
	array = [int(item) for item in input().split()]
	value = 0
	addition = 0
	for item in array:
		if item == 0:
			value += 1
			addition += 1
		else:
			value += item
	if value == 0:
		print(addition + 1)
	else:
		print(addition)


import sys
input = sys.stdin.readline
Q = int(input())
Query = []
for _ in range(Q):
	N = int(input())
	A = list(map(int, input().split()))
	Query.append((N, A))
for (N, A) in Query:
	ans = 0
	for a in A:
		if a == 0:
			ans += 1
	if sum(A) + ans == 0:
		ans += 1
	print(ans)


t = int(input())
for i in range(t):
	count = 0
	total = 0
	n = int(input())
	array = list(map(int, input().split(' ')))
	for j in range(n):
		if array[j] == 0:
			count = count + 1
			array[j] += 1
	for ele in range(n):
		total = total + array[ele]
	if total == 0:
		count = count + 1
	print(count)


import sys
for _ in range(int(sys.stdin.readline().split()[0])):
	n = int(sys.stdin.readline().split()[0])
	a = list(map(int, sys.stdin.readline().split()))
	count = 0
	if 0 in a:
		count += a.count(0)
	if sum(a) + count == 0:
		count += 1
	print(count)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	s = sum(l)
	p = 1
	c = 0
	for i in range(n):
		p *= l[i]
	while s == 0 or p == 0:
		for i in range(n):
			if l[i] == 0:
				l[i] = 1
				c = c + 1
		s = sum(l)
		p = 1
		for i in range(n):
			p *= l[i]
		if s == 0:
			c = c + 1
			for i in range(n):
				if l[i] > 0:
					l[i] = l[i] + 1
		s = sum(l)
		p = 1
		for i in range(n):
			p *= l[i]
	print(c)


from collections import deque
import itertools
import operator
import queue
import time
import math
import sys
import os
t = int(input())
for k in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	p = 1
	s = 0
	m = 0
	z = 0
	for i in range(n):
		p *= a[i]
		s += a[i]
		if a[i] == -1:
			m += 1
		if a[i] == 0:
			z += 1
	if p != 0 and s != 0:
		print(0)
		continue
	if p == 0:
		if s + z == 0:
			print(z + 1)
		elif s == 0:
			print(z)
		else:
			print(z)
	elif p != 0:
		if s == 0:
			if n - m > 0:
				print(1)
			else:
				print(2)
		elif s == -1:
			print(2)


jurica = int(input())
ispis = 0
while jurica:
	clan = int(input())
	niz = list(map(int, input().split()))
	for i in range(len(niz)):
		if niz[i] == 0:
			ispis += 1
			niz[i] = 1
	if sum(niz) == 0:
		ispis += 1
	print(ispis)
	ispis = 0
	jurica -= 1


for _ in range(int(input())):
	n = int(input())
	L = list(map(int, input().split()))
	r = 0
	s = 0
	for l in L:
		s += l
		r += l == 0
	s += r
	if s == 0:
		print(r + 1)
	else:
		print(r)


t = int(input())
for i in range(t):
	k = 0
	n = int(input())
	a = [int(i) for i in input().split(' ')]
	for i in range(n):
		if a[i] == 0:
			a[i] += 1
			k += 1
	summ = 0
	for i in range(n):
		summ += a[i]
	if summ == 0:
		for i in range(n):
			if a[i] != -1:
				k += 1
				break
		else:
			k += 2
	print(k)


for _ in range(int(input())):
	n = int(input())
	total = 0
	zeros = 0
	for i in map(int, input().split()):
		if i == 0:
			zeros += 1
		else:
			total += i
	if total + zeros == 0:
		print(zeros + 1)
	else:
		print(zeros)


for _ in range(int(input())):
	N = int(input())
	X = list(map(int, input().split()))
	Zeros = X.count(0)
	Sum = sum(X)
	if Sum == 0:
		print(1 if Zeros == 0 else Zeros)
		continue
	if Zeros:
		print(Zeros + 1 if Zeros + Sum == 0 else Zeros)
		continue
	print(0)


import sys
for (i, line) in enumerate(sys.stdin):
	if i == 0:
		t = int(line.split()[0])
	elif i % 2 == 0:
		sum = 0
		zeros = 0
		for num in line.split(' '):
			x = int(num)
			if x == 0:
				zeros += 1
			else:
				sum += x
		if zeros == 0:
			if sum == 0:
				print(1)
			else:
				print(0)
		elif sum > 0:
			print(zeros)
		elif zeros != abs(sum):
			print(zeros)
		else:
			print(zeros + 1)


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = [int(i) for i in input().split()]
		answer = 0
		for i in range(n):
			if a[i] == 0:
				answer += 1
				a[i] += 1
		if sum(a) == 0:
			answer += 1
		print(answer)
main()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	x = 0
	s = 0
	p = 1
	for i in l:
		if i == 0:
			x += 1
		s += i
		p *= i
	if s != 0 and p != 0:
		print(0)
	elif p != 0 and s == 0:
		print(1)
	elif s != 0 and p == 0:
		if s > 0:
			print(x)
		elif abs(s) == x:
			print(x + 1)
		else:
			print(x)
	elif s == 0 and p == 0:
		print(x)


ar_count = []
n = int(input())
for i in range(n):
	ar = []
	count = 0
	sum = 0
	e = int(input())
	for b in input().split():
		ar.append(int(b))
	for b in range(len(ar)):
		if ar[b] == 0:
			ar[b] = 1
			count += 1
		sum = sum + ar[b]
	if sum == 0:
		for b in range(len(ar)):
			if ar[b] != -1:
				ar[b] += 1
				count += 1
				break
	ar_count.append(count)
for i in range(n):
	print(ar_count[i])


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	zeros = a.count(0)
	s = sum(a) + zeros
	if s == 0:
		print(zeros + 1)
	else:
		print(zeros)


t = int(input())
a = []
for i in range(t):
	n = input()
	b = list(map(int, input().split()))
	a.append(b)
for i in a:
	k = sum(i)
	p = i.count(0)
	if k == 0 and p <= 1:
		print(1)
	elif k == 0 and p > 1:
		print(p)
	elif k == -p:
		print(p + 1)
	else:
		print(p)


t = int(input())
for q in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	ans = 0
	ans += arr.count(0)
	if sum(arr) + arr.count(0) == 0:
		ans += 1
	print(ans)


from sys import stdin
t = int(stdin.readline())
for _ in range(t):
	s = 0
	zero = 0
	n = int(stdin.readline())
	for x in stdin.readline().rstrip().split():
		x = int(x)
		if x == 0:
			zero += 1
		s += x
	if s == -zero:
		print(zero + 1)
	else:
		print(zero)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	zeroes = a.count(0)
	minusone = a.count(-1)
	summe = sum(a)
	if summe != 0 and zeroes == 0:
		print(0)
	elif zeroes == 0 and minusone > 0:
		print(1)
	elif zeroes != -summe:
		print(zeroes)
	elif zeroes == -summe:
		print(zeroes + 1)


def fun(x):
	d = dict()
	s = 0
	p = 1
	v = 0
	for i in x:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
		s += i
		p *= i
	if 0 in d:
		s += d[0]
		v += d[0]
		if s == 0:
			if -1 in d and len(d) == 2:
				v += 1
				s += 1
	if s == 0:
		if len(d) == 1 and -1 in d:
			v += 2
		else:
			v += 1
	return v
n = int(input())
for i in range(n):
	l = int(input())
	arr = list(map(int, input().split()))
	print(fun(arr))


for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	ans = 0
	for i in range(n):
		if lst[i] == 0:
			lst[i] = 1
			ans += 1
	tot = sum(lst)
	if tot != 0:
		print(ans)
	else:
		print(ans + 1)


import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce
sys.setrecursionlimit(4100000)
INF = 1 << 60
MOD = 10 ** 9 + 7
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	cnt = 0
	for j in a:
		if j == 0:
			cnt += 1
	if sum(a) + cnt == 0:
		cnt += 1
	print(cnt)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	s = 0
	c = 0
	for i in a:
		if i == 0:
			c += 1
		s += i
	s += c
	if s == 0:
		print(c + 1)
	else:
		print(c)


t = int(input())
for i in range(0, t):
	n = int(input())
	step = 0
	sum = 0
	a = [int(x) for x in input().split(' ')]
	for j in range(0, n):
		if a[j] == 0:
			a[j] += 1
			step = step + 1
		sum += a[j]
	if sum == 0:
		print(step + 1)
	else:
		print(step)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = [int(x) for x in input().strip().split()]
	s = sum(a)
	m = 0
	for i in range(0, n):
		x = a[i]
		if x == 0:
			m += 1
			a[i] = 1
	s += m
	if s != 0:
		print(m)
	else:
		print(m + 1)


import math
import functools

def calculate(data):
	list_sum = sum(data)
	zero_count = data.count(0)
	if zero_count == 0 and list_sum != 0:
		return 0
	count = 0
	for i in range(len(data)):
		if data[i] == 0:
			data[i] = 1
			count += 1
	list_sum = sum(data)
	if list_sum != 0:
		return count
	return count + 1
T = int(input())
for i in range(T):
	length = int(input())
	data = list(map(int, input().split()))
	print(calculate(data))


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split(' ')]
	zeros = a.count(0)
	if sum(a) + zeros == 0:
		print(str(zeros + 1))
	else:
		print(zeros)


read = lambda : list(map(int, input().split(' ')))
t = int(input())
for i in range(t):
	n = int(input())
	arr = read()
	summ = 0
	count = 0
	for j in arr:
		if j == 0:
			summ += 1
			count += 1
		else:
			summ += j
	if summ == 0:
		print(count + 1)
	else:
		print(count)


from math import ceil
from collections import deque
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	ans = a.count(0)
	print(ans + (sum(a) + ans == 0))


test = int(input())
while test:
	n = int(input())
	sum = 0
	step = 0
	arr = input().split(' ')
	for i in arr:
		tmp = int(i)
		if tmp:
			sum += tmp
		else:
			step += 1
			sum += 1
	if sum == 0:
		step += 1
	print(step)
	test -= 1


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 0
	mm = -101
	mmc = 0
	for i in a:
		if i == 0:
			ans += 1
	sa = sum(a) + ans
	if sa == 0:
		ans += 1
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(x) for x in input().split(' ')]
	z_c = arr.count(0)
	if sum(arr) + z_c == 0:
		print(z_c + 1)
	else:
		print(z_c)


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	sums = 0
	cnt = 0
	for x in a:
		if x == 0:
			cnt += 1
			sums += x + 1
		else:
			sums += x
	if sums == 0:
		cnt += 1
	print(cnt)


input = __import__('sys').stdin.readline
MIS = lambda : map(int, input().split())
for TEST in range(int(input())):
	n = int(input())
	arr = list(MIS())
	op = 0
	for i in range(n):
		if arr[i] == 0:
			op += 1
			arr[i] += 1
	if sum(arr) == 0:
		op += 1
	print(op)


def checksum(arr):
	if sum(arr) == 0:
		return True
	return False

def checkproduct(arr):
	if 0 in arr:
		return True
	return False
for z in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	if checksum(arr) == False and checkproduct(arr) == False:
		print(0)
		continue
	if checksum(arr) == True and checkproduct(arr) == True:
		num_0 = arr.count(0)
		print(num_0)
	elif checksum(arr) == True and checkproduct(arr) == False:
		print(1)
	elif checksum(arr) == False and checkproduct(arr) == True:
		num_0 = arr.count(0)
		for i in range(n):
			if arr[i] == 0:
				arr[i] = 1
		if checksum(arr):
			print(num_0 + 1)
		else:
			print(num_0)


for i in range(int(input())):
	n = int(input())
	arr = [int(_) for _ in input().split()]
	val = 0
	val += arr.count(0)
	if arr.count(0) > 0:
		if sum(arr) + val == 0:
			val += 1
	if sum(arr) + val == 0:
		val += 1
	print(val)


from collections import Counter

def solve():
	n = int(input())
	array = list(map(int, input().split()))
	array.sort()
	(sum, count) = (0, 0)
	for i in array:
		if i == 0:
			count += 1
			sum += 1
		else:
			sum += i
	if sum == 0:
		if array[-1] >= 0:
			count += 1
		else:
			count += abs(array[-1])
	return count
for i in range(int(input())):
	print(solve())


for _ in range(int(input())):
	n = int(input())
	arr = [int(a) for a in input().split()]
	count = 0

	def sum_arr(arr):
		sum = 0
		for i in range(len(arr)):
			sum = sum + arr[i]
		return sum

	def multi_arr(arr):
		multi = 0
		for i in range(len(arr)):
			multi = multi * arr[i]
		return multi
	if sum_arr(arr) != 0 and multi_arr(arr) != 0:
		count = 0
	if multi_arr(arr) == 0:
		for i in range(len(arr)):
			if arr[i] == 0:
				arr[i] += 1
				count += 1
	if sum_arr(arr) == 0:
		for i in range(len(arr)):
			arr[i] += 1
			count += 1
			if arr[i] != 0:
				break
			else:
				count -= 1
				arr[i] -= 1
	print(count)


t = int(input())
for i in range(t):
	e = int(input())
	l = list(map(int, input().split()))
	w = l.count(0)
	if w + sum(l) == 0:
		print(w + 1)
	else:
		print(w)


from collections import Counter
t = int(input())

def solve():
	input()
	arr = [int(i) for i in input().split()]
	us = {0: []}
	ans = 0
	for i in range(len(arr)):
		if arr[i] == 0:
			us[0].append(i)
	for i in us[0]:
		ans += 1
		arr[i] = 1
	s = sum(arr)
	if s == 0:
		ans += 1
	print(ans)
while t:
	solve()
	t -= 1


for _ in range(1, int(input()) + 1):
	input()
	ar = [int(x) for x in input().split()]
	su = sum(ar)
	prod = 1
	for i in range(len(ar)):
		prod *= ar[i]
	if su > 0 and prod > 0:
		print(0)
	else:
		c = ar.count(0)
		print(c + (sum(ar) + c == 0))


t = int(input())
L = []
for i in range(t):
	l = int(input())
	s = [int(x) for x in input().split()]
	c = s.count(0)
	if c != 0:
		s = [1 if x == 0 else x for x in s]
	if sum(s) == 0:
		c += 1
	L.append(c)
for i in L:
	print(i)


for ahah in range(int(input())):
	n = int(input())
	mas = list(map(int, input().split()))
	zer = 0
	for i in mas:
		if i == 0:
			zer += 1
	sm = sum(list(map(int, mas)))
	sm += zer
	otv = zer
	if sm == 0:
		otv += 1
	print(otv)


for i in range(int(input())):
	n = int(input())
	arr = [int(elem) for elem in input().split()]
	number_of_zeros = 0
	for i in range(len(arr)):
		if arr[i] == 0:
			number_of_zeros += 1
	if sum(arr) == 0:
		print(max(1, number_of_zeros))
	elif number_of_zeros == -sum(arr):
		print(number_of_zeros + 1)
	else:
		print(number_of_zeros)


t = int(input())
for _ in range(t):
	n = int(input())
	a = input().split()
	(ans, total) = (0, 0)
	for val in a:
		val = int(val)
		if val == 0:
			ans += 1
			total += 1
		total += val
	if total:
		print(ans)
	else:
		print(ans + 1)


def product(a):
	res = 1
	for i in a:
		res *= i
	return res
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	steps = 0
	if sum(a) and product(a):
		print(0)
		continue
	else:
		if not sum(a) and (not product(a)):
			for i in range(n):
				if a[i] == 0:
					a[i] += 1
					steps += 1
		if sum(a):
			for i in range(n):
				if a[i] == 0:
					a[i] += 1
					steps += 1
		if product(a) and (not sum(a)):
			steps += 1
		print(steps)


t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	zeros = 0
	sm = 0
	pro = 1
	for a in arr:
		if a == 0:
			zeros += 1
		sm += a
		pro *= a
	moves = 0
	if sm != 0 and pro != 0:
		pass
	elif pro == 0 and sm == 0:
		moves += zeros
	elif pro == 0:
		moves += zeros
		if sm + moves == 0:
			moves += 1
	else:
		moves += 1
	ans.append(str(moves))
print('\n'.join(ans))


for _ in range(int(input())):
	input()
	arr_sum = 0
	prod = 1
	steps = 0
	count = {}
	arr = map(int, input().split(' '))
	max_el = -10 ** 9
	min_el = 10 ** 9
	for n in arr:
		if n == 0:
			n += 1
			steps += 1
		arr_sum += n
		prod *= n
		max_el = max(n, max_el)
		min_el = min(n, min_el)
		count[n] = count.get(n, 0) + 1
	assert prod != 0
	if arr_sum != 0:
		print(steps)
		continue
	if max_el > 0:
		steps += 1
		count[max_el] -= 1
		count[max_el + 1] = count.get(max_el + 1, 0) + 1
		print(steps)
		continue
	n = min(min_el, max_el)
	if n + 1 != 0:
		steps += 1
		count[n] -= 1
		count[n + 1] = count.get(min_el + 1, 0) + 1
		print(steps)
		continue
	steps += 2
	count[n] -= 1
	count[n + 2] = count.get(n + 2, 0) + 1
	print(steps)


from functools import reduce
t = int(input())
for i in range(t):
	min_s = 0
	n = int(input())
	a = list(map(int, input().split()))
	for i in a:
		if i is 0:
			min_s += 1
	s = sum(a)
	p = reduce(lambda x, y: x * y, a)
	if s is not 0 and p is not 0:
		print(0)
		continue
	if s + min_s is not 0:
		print(min_s)
	else:
		print(min_s + 1)


t = int(input())
for i in range(t):
	n = int(input())
	a = input().split(' ')
	firstPositive = 0
	lowestNegative = 0
	moves = 0
	sum = 0
	for j in range(n):
		numb = int(a[j])
		if numb > 0:
			firstPositive = numb
		if numb < lowestNegative:
			lowestNegative = numb
		if numb == 0:
			sum += 1
			moves += 1
			firstPositive = 1
		sum += numb
	if sum == 0 and (firstPositive or lowestNegative != -1):
		moves += 1
	elif sum == 0 and lowestNegative == -1:
		moves += 2
	print(moves)


def solve(arr):
	s = sum(arr)
	zero = arr.count(0)
	ans = 0
	if zero:
		ans = zero
		if s + zero == 0:
			ans += 1
		return ans
	if s == 0:
		return 1
	return 0
TC = int(input())
for _ in range(TC):
	_ = input()
	(*arr,) = map(int, input().split())
	print(solve(arr))


def program():
	n = int(input())
	l = list(map(int, input().split()))
	allneg = True
	ans = l.count(0)
	s = sum(l) + ans
	if s == 0:
		ans = ans + 1
	print(ans)
t = int(input())
for i in range(t):
	program()


N = int(input())
for _ in range(N):
	n = int(input())
	lst = list(map(int, input().split()))
	ans = 0
	for i in range(len(lst)):
		if lst[i] == 0:
			ans += 1
			lst[i] += 1
	if sum(lst) == 0:
		ans += 1
	print(ans)


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s = 0
	o = 0
	for i in range(len(l)):
		if l[i] == 0:
			l[i] += 1
			s += 1
		o += l[i]
	if o == 0:
		print(s + 1)
	else:
		print(s)


from sys import stdin, stdout
from os import path
if path.exists('inp.txt'):
	stdin = open('inp.txt', 'r')
q = int(stdin.readline())
for _ in range(q):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	ans = 0
	res = 0
	for i in a:
		if not i:
			ans += 1
			i += 1
		res += i
	print(ans if res else ans + 1)


for _ in range(int(input())):
	n = int(input())
	s = 0
	p = 1
	arr = list(map(int, input().split()))
	zer = 0
	for i in arr:
		s += i
	c = 0
	for i in arr:
		if i == 0:
			c += 1
			s += 1
	if s == 0:
		c += 1
	print(c)


__author__ = 'tanunia'
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	nm = 0
	sm = 0
	for it in a:
		if it == 0:
			nm += 1
			sm += 1
		else:
			sm += it
	if sm == 0:
		nm += 1
	print(nm)


def answer():
	n = int(input())
	while n:
		a = int(input())
		b = [int(x) for x in input().split()]
		prod = 1
		ans = 0
		while not sum(b) or 0 in b:
			i = 0
			while i < len(b):
				if b[i] == 0:
					ans += 1
					b[i] += 1
				i += 1
			if sum(b) == 0:
				ans += 1
				break
		print(ans)
		n -= 1
answer()


def main():
	from sys import stdin, stdout
	for _ in range(int(stdin.readline())):
		N = int(stdin.readline())
		arr = list(map(int, stdin.readline().split()))
		zeroes = 0
		for i in arr:
			if i == 0:
				zeroes += 1
		if zeroes + sum(arr) == 0:
			zeroes += 1
		stdout.write(str(zeroes) + '\n')
main()


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	count = 0
	if 0 in arr:
		for i in range(n):
			if arr[i] == 0:
				arr[i] = arr[i] + 1
				count += 1
	if sum(arr) > 0:
		print(count)
	else:
		while sum(arr) == 0:
			count += 1
			arr[-1] = arr[-1] + 1
		print(count)


T = int(input())
for _ in range(T):
	n = int(input())
	array = list(map(int, input().split()))
	steps = 0
	while array.count(0) > 0:
		index = array.index(0)
		array[index] += 1
		steps += 1
	if sum(array) == 0:
		maximum = max(array)
		minimum = min(array)
		if maximum != -1:
			maximum += 1
			steps += 1
		elif minimum != -1:
			minimum += 1
			steps += 1
		else:
			maximum += 2
			steps += 2
	print(steps)


t = int(input())
for case in range(t):
	n = int(input())
	inp = list(map(int, input().split()))
	tot = sum(inp)
	zCount = 0
	for x in inp:
		if x == 0:
			zCount += 1
	tot += zCount
	ans = zCount
	if tot == 0:
		ans += 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split()]
	a = sum(l)
	SUM = PROD = False
	if a != 0:
		SUM = True
	PROD = 0 not in l
	if SUM and PROD:
		print(0)
	elif SUM and (not PROD):
		ans = l.count(0)
		if ans + a == 0:
			ans += 1
		print(ans)
	elif PROD and (not SUM):
		print(1)
	else:
		ans = l.count(0)
		if ans + a == 0:
			ans += 1
		print(ans)


t = int(input())
for j in range(t):
	n = int(input())
	res = 0
	cntp = 0
	a = list(map(int, input().split()))
	for i in range(n):
		if a[i] == 0:
			res += 1
			a[i] += 1
	if sum(a) == 0:
		for i in range(n):
			if a[i] != -1:
				cntp += 1
		if cntp == 0:
			res += 2
		else:
			res += 1
	print(res)


N = int(input())
for _ in range(N):
	x = int(input())
	a = list(map(int, input().split()))
	res = 0
	for i in a:
		if i == 0:
			res += 1
	if res == 0:
		if sum(a) == 0:
			print(1)
		else:
			print(0)
	elif sum(a) + res == 0:
		print(res + 1)
	else:
		print(res)


sol = []
n = int(input())

def solve(a):
	sum = 0
	prod = 1
	c = 0
	for i in range(len(a)):
		if a[i] == 0:
			a[i] = 1
			c += 1
		sum += a[i]
	if sum == 0:
		c += 1
	return c
for i in range(n):
	s = int(input())
	l = list(map(int, input().split()))
	sol.append(solve(l))
for i in sol:
	print(i)


T = int(input())
answer = ''
for t in range(T):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	result = 0
	s = 0
	for i in range(n):
		if arr[i] == 0:
			result += 1
			arr[i] += 1
		s += arr[i]
	if s == 0:
		result += 1
	answer += str(result) + '\n'
print(answer)


t = int(input())
while t > 0:
	n = int(input())
	list = [int(i) for i in input().split()]
	(som, mult, zero) = (0, 1, 0)
	for i in range(n):
		som += list[i]
		mult *= list[i]
		if list[i] == 0:
			zero += 1
	if som == 0 and mult != 0:
		print(1)
	elif som == 0 and mult == 0:
		print(zero)
	else:
		cnt = 0
		for i in range(n):
			if list[i] == 0:
				list[i] = 1
				cnt += 1
		som = sum(list)
		if som == 0:
			print(cnt + 1)
		else:
			print(cnt)
	t -= 1


t = int(input())
ls = [list(map(int, input().split())) for _ in range(2 * t)]
n = []
a = []
for i in range(2 * t):
	if i % 2 == 0:
		n.append(ls[i])
	elif i % 2 == 1:
		a.append(ls[i])
for j in range(t):
	cnt = 0
	for k in range(len(a[j])):
		if a[j][k] == 0:
			cnt += 1
	if cnt == 0:
		if sum(a[j]) == 0:
			print(1)
		else:
			print(0)
	elif cnt != 0:
		if sum(a[j]) + cnt == 0:
			print(cnt + 1)
		else:
			print(cnt)


def prod(nums):
	tot = 1
	for i in nums:
		tot *= i
	return tot
t = int(input())
for i in range(t):
	n = int(input())
	nums = list(map(int, input().split()))
	c = 0
	pos = 0
	s = sum(nums)
	z = nums.count(0)
	while z != 0 or s == 0:
		if nums[pos] == 0:
			nums[pos] += 1
			c += 1
			z -= 1
			s += 1
		elif z == 0:
			nums[pos] += 1
			s += 1
			c += 1
		pos += 1
		pos %= n
	print(c)


n = int(input())
count = 0
steps = []
while count < n:
	t = int(input())
	a = input()
	num_zeros = 0
	p = 0
	ne = 0
	step = 0
	for x in a.split():
		if x == '0':
			num_zeros += 1
		elif '-' in x:
			ne += int(x[1:])
		else:
			p += int(x)
	step += num_zeros
	p += num_zeros
	dif = abs(p - ne)
	if dif == 0:
		step += 1
		steps.append(step)
	else:
		steps.append(step)
	count += 1
for y in steps:
	print(y)


t = int(input())
for test in range(t):
	n = int(input())
	A = list(map(int, input().split(' ')))
	ans = 0
	for i in range(n):
		if A[i] == 0:
			ans += 1
			A[i] += 1
	if sum(A) == 0:
		ans += 1
	print(ans)


t = int(input())
for i in range(t):
	s = 0
	c = 0
	n = int(input())
	a = [int(item) for item in input().split()]
	if '0' in str(a):
		for (m, j) in enumerate(a):
			if j == 0:
				a[m] = 1
				s += 1
		if sum(a[:]) != 0:
			print(s)
		else:
			s += 1
			print(s)
	elif sum(a[:]) != 0:
		print(0)
	elif sum(a[:]) == 0:
		print(1)


number_of_test_cases = int(input())
for i in range(number_of_test_cases):
	number_of_numbers = int(input())
	numbers = list(map(int, input().split(' ')))
	counter = 0
	for i in range(number_of_numbers):
		if numbers[i] == 0:
			numbers[i] = numbers[i] + 1
			counter = counter + 1
	sum = 0
	for i in range(number_of_numbers):
		sum = sum + numbers[i]
	if sum == 0:
		print(counter + 1)
	else:
		print(counter)


import sys
import math
import heapq
import bisect
import re
from collections import deque
from decimal import *
from fractions import gcd

def YES_NO(flag):
	if flag:
		print('AWW')
	else:
		print('WAW')

def main():
	n = int(sys.stdin.readline())
	q = [int(i) for i in sys.stdin.readline().split()]
	w = q.count(0)
	if w + sum(q) == 0:
		print(w + 1)
	else:
		print(w)
for i in range(int(sys.stdin.readline())):
	main()


import sys
import math
from statistics import mean
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())
t = inp()
for i in range(t):
	n = inp()
	li = inlt()
	zc = 0
	for j in range(n):
		if li[j] == 0:
			zc = zc + 1
			li[j] = 1
	s = sum(li)
	if s == 0:
		zc = zc + 1
	print(zc)


t = int(input())
for _ in range(t):
	k = 0
	n = int(input())
	a = list(map(int, input().split()))
	prod = 1
	for i in a:
		prod *= i
	while prod == 0 or sum(a) == 0:
		if prod == 0:
			for i in range(len(a)):
				if a[i] == 0:
					a[i] += 1
					k += 1
		if sum(a) == 0:
			for i in range(len(a)):
				if a[i] + 1 != 0:
					a[i] += 1
					k += 1
					break
		if sum(a) == 0:
			k += 2
		prod = 1
		for i in a:
			prod *= i
	print(k)


import sys
input = lambda : sys.stdin.readline().rstrip()
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = a.count(0)
	for i in range(n):
		if a[i] == 0:
			a[i] += 1
	if sum(a) == 0:
		ans += 1
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	a = [*map(int, input().split())]
	steps = 0
	sum = 0
	for i in range(n):
		if a[i] == 0:
			steps += 1
			a[i] = 1
		sum += a[i]
	if sum == 0:
		steps += 1
	print(steps)


def func(arr):
	steps = arr.count(0)
	if sum(arr) + steps == 0:
		steps += 1
	print('{} \n'.format(steps))
T = int(input())
for i in range(T):
	n = int(input())
	line_ = input()
	arr = line_.split(' ')
	arr_int = [int(x) for x in arr]
	func(arr_int)


res = ''
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	r = a.count(0)
	if sum(a) + r == 0:
		res += str(r + 1) + '\n'
	else:
		res += str(r) + '\n'
print(res)


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	z = a.count(0)
	sm = sum(a) + z
	print(z + int(sm == 0))


t = int(input())
out = []
for i in range(t):
	n = int(input())
	xs = list(map(int, input().split(' ')))
	s = sum(xs)
	zc = len(list(filter(lambda x: x == 0, xs)))
	if zc > 0:
		p = 0
	else:
		p = 1
		for x in xs:
			p *= x
	if s == 0 and p == 0:
		out.append(zc)
	elif s == 0:
		out.append(1)
	elif p == 0:
		s += zc
		if s == 0:
			out.append(zc + 1)
		else:
			out.append(zc)
	else:
		out.append(0)
for o in out:
	print(o)


def prod(array):
	product = 1
	for i in array:
		product *= i
	return product
test_case = int(input())
for _ in range(test_case):
	n = int(input())
	a = list(map(int, input().split()))
	zeros = a.count(0)
	summation = sum(a)
	if zeros == 0:
		print(0 if summation else 1)
	else:
		print(zeros + 1 if summation + zeros == 0 else zeros)


t = int(input())
for test in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	p = arr.count(0)
	s = sum(arr)
	if s == 0 and p == 0:
		print(1)
	if s != 0 and p == 0:
		print(0)
	if s == 0 and p != 0:
		print(p)
	if s != 0 and p != 0:
		if p + s == 0:
			print(p + 1)
		else:
			print(p)


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [input() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [int(input()) for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

class PriorityQueue:

	def __init__(self, l=[]):
		self.q = l
		heapq.heapify(self.q)
		return

	def push(self, n):
		heapq.heappush(self.q, n)
		return

	def pop(self):
		return heapq.heappop(self.q)

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def main():
	T = Scanner.int()
	for _ in range(T):
		n = Scanner.int()
		A = Scanner.map_int()
		ans = A.count(0)
		A = [a + 1 if a == 0 else a for a in A]
		if sum(A) == 0:
			ans += 1
		print(ans)
main()


t = int(input())
while t > 0:
	n = int(input())
	A = list(map(int, input().split()))
	A.sort()
	(count, sum) = (0, 0)
	for i in range(len(A)):
		if A[i] == 0:
			count += 1
			A[i] = 1
	for i in range(len(A)):
		sum += A[i]
	if sum == 0:
		count += 1
	print(count)
	t -= 1


def one_more(lst):
	a = sum(lst) + lst.count(0)
	return lst.count(0) + 1 if a == 0 else lst.count(0)
for _ in range(int(input())):
	m = int(input())
	b = [int(i) for i in input().split()]
	print(one_more(b))


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()
from random import randint
from collections import defaultdict, deque

class Graph(object):

	def __init__(self, dic):
		self.dict = dic
		self.vertex = set()

	def addedge(self, a, b):
		if self.dict[a] == []:
			self.vertex.add(a)
		if b != None:
			self.dict[a].append(b)

	def con_com_util(self, i, unvisited, count, comp):
		for j in self.dict[i]:
			if j in unvisited:
				unvisited.remove(j)
				comp[count].append(j)
				comp = self.con_com_util(j, unvisited, count, comp)
		return comp

	def conn_components(self):
		unvisited = self.vertex.copy()
		count = 0
		comp = defaultdict(list)
		while unvisited:
			i = unvisited.pop()
			comp[count].append(i)
			comp = self.con_com_util(i, unvisited, count, comp)
			count += 1
		return (count, comp)

def countSetBits(n):
	count = 0
	while n:
		n &= n - 1
		count += 1
	return count
import random

def primesbelow(N):
	correction = N % 6 > 1
	N = {0: N, 1: N - 1, 2: N + 4, 3: N + 3, 4: N + 2, 5: N + 1}[N % 6]
	sieve = [True] * (N // 3)
	sieve[0] = False
	for i in range(int(N ** 0.5) // 3 + 1):
		if sieve[i]:
			k = 3 * i + 1 | 1
			sieve[k * k // 3::2 * k] = [False] * ((N // 6 - k * k // 6 - 1) // k + 1)
			sieve[(k * k + 4 * k - 2 * k * (i % 2)) // 3::2 * k] = [False] * ((N // 6 - (k * k + 4 * k - 2 * k * (i % 2)) // 6 - 1) // k + 1)
	return [2, 3] + [3 * i + 1 | 1 for i in range(1, N // 3 - correction) if sieve[i]]

def solve():
	n = int(inp())
	ar = lis()
	k = sum(ar)
	c = ar.count(0)
	if k + c == 0:
		print(c + 1)
	else:
		print(c)
testcase(int(inp()))


import bisect
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate

def primeFactors(n):
	prime = set()
	while n % 2 == 0:
		prime.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			prime.add(i)
			n = n // i
	if n > 2:
		prime.add(n)
	return list(prime)

def getFactors(n):
	factors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				factors.append(i)
			else:
				factors.append(i)
				factors.append(n // i)
		i = i + 1
	return factors

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	num = []
	for p in range(2, n + 1):
		if prime[p]:
			num.append(p)
	return num

def lcm(a, b):
	return a * b // math.gcd(a, b)

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

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

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

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def solve():
	n = int(input())
	arr = list_input()
	cost = 0
	for i in range(n):
		if arr[i] == 0:
			cost += 1
			arr[i] += 1
	if sum(arr) == 0:
		cost += 1
	print(cost)
t = int(input())
for _ in range(t):
	solve()


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	k = l.count(0)
	if k == 0:
		s = sum(l)
		if s == 0:
			print(1)
		if s != 0:
			print(0)
	else:
		s = sum(l) + k
		if s == 0:
			print(k + 1)
		else:
			print(k)


for i in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	x = li.count(0)
	test = []
	for i in li:
		if i != 0:
			test.append(i)
		else:
			test.append(1)
	if sum(test) == 0:
		x = x + 1
	print(x)


from sys import stdout

def multzero(listnums):
	total = 0
	for i in range(len(listnums)):
		if listnums[i] == 0:
			listnums[i] += 1
			total += 1
	return total

def sumzero(listnums):
	sum = 0
	highest = 0
	lowest = 0
	for i in range(len(listnums)):
		if listnums[i] > listnums[highest]:
			highest = i
		if listnums[i] < listnums[lowest]:
			lowest = i
		sum += listnums[i]
	if sum == 0:
		if listnums[highest] >= 0:
			return 1
		return 2
	return 0

def main():
	total = 0
	repeat = int(input())
	listnums = []
	for x in range(repeat):
		length = int(input())
		stringnums = input()
		listnums = stringnums.split()
		listnums = [int(i) for i in listnums]
		total = multzero(listnums)
		total += sumzero(listnums)
		print(total)
		stdout.flush()
main()


t = int(input())
for i in range(t):
	n = int(input())
	b = []
	c = 0
	a = list(map(int, input().split()))
	for j in range(n):
		if a[j] == 0:
			b.append(j)
	for j in range(len(b)):
		a[b[j]] = a[b[j]] + 1
		c = c + 1
	if sum(a) == 0:
		c = c + 1
	print(c)


T = int(input())
for j in range(T):
	n = int(input())
	l = list(map(int, input().split()))
	ze = 0
	for i in range(n):
		if l[i] == 0:
			ze += 1
	su = sum(l)
	if su + ze == 0:
		print(ze + 1)
	else:
		print(ze)


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	ss = a.count(0)
	s = sum(a)
	if s + ss == 0:
		print(ss + 1)
	else:
		print(ss)


testcase = int(input())
for index in range(testcase):
	Sum = 0
	np = input()
	imp = list(map(int, input().split()))
	Sum = sum(imp) + imp.count(0)
	if Sum == 0:
		print(1 + imp.count(0))
	else:
		print(imp.count(0))


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().strip().split()))
	t = l.count(0)
	s = sum(l) + t
	if s == 0:
		t += 1
		print(t)
	else:
		print(t)


def main():
	q = int(input())
	while q > 0:
		q = q - 1
		n = int(input())
		sum = 0
		amont = 0
		a = list(map(int, input().split()))
		for i in range(n):
			amont = amont + a[i]
			if a[i] == 0:
				sum = sum + 1
				amont = amont + 1
		if amont == 0:
			print(sum + 1)
		else:
			print(sum)
main()


I = input
for i in range(int(I())):
	n = 0
	k = 0
	m = int(I())
	x = list(map(int, I().split()))
	for j in range(m):
		if x[j] == 0:
			k += 1
		else:
			n += x[j]
	if n + k == 0:
		print(k + 1)
	else:
		print(k)


mod = 10 ** 9 + 7
import math
from bisect import bisect_left
from collections import Counter
from itertools import combinations

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

def fain():
	return map(float, input().split())
for _ in range(int(input())):
	n = int(input())
	a = list(ain())
	sumv = sum(a)
	zeroCount = a.count(0)
	if zeroCount + sumv != 0:
		print(zeroCount)
	else:
		print(zeroCount + 1)


t = int(input())
for k in range(t):
	n = int(input())
	nums = list(map(int, input().split()))
	n_zeros = nums.count(0)
	cnt = n_zeros
	s_positive = sum([nums[i] for i in range(n) if nums[i] > 0]) + n_zeros
	s_negative = sum([nums[i] for i in range(n) if nums[i] < 0])
	if s_positive == -s_negative:
		cnt += 1
	print(cnt)


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


for _ in range(int(input())):
	n = int(input())
	s = input().split()
	nd = 0
	sum = 0
	for i in s:
		sum = sum + int(i)
		if i == '0':
			nd += 1
	if sum + nd == 0:
		print(nd + 1)
	else:
		print(nd)


t = int(input())
for i in range(t):
	n = int(input())
	s = 0
	A = list(map(int, input().split()))
	while 0 in A:
		if 0 in A:
			A[A.index(0)] += 1
			s += 1
	if sum(A) == 0:
		for j in range(n):
			if A[j] != -1:
				A[j] += 1
				s += 1
				break
	if sum(A) == 0:
		s += 2
	print(s)


n = int(input())
for i in range(n):
	s1 = int(input())
	s2 = list(map(int, input().split()))
	p = 1
	s = 0
	count = 0
	for i in range(s1):
		s = s + s2[i]
		p = p * s2[i]
		if p == 0:
			if s2[i] == 0:
				s2[i] = s2[i] + 1
				count += 1
	s += count
	if s == 0:
		print(count + 1)
	else:
		print(count)


t = int(input())
for _ in range(t):
	n = int(input())
	al = list(map(int, input().split()))
	k = al.count(0)
	if sum(al) + k == 0:
		print(k + 1)
	else:
		print(k)


total = int(input())
while total:
	c1 = 0
	c = 0
	n = int(input())
	l = [int(i) for i in input().split()]
	c = l.count(0)
	ans = sum(l)
	while ans == 0 or c > 0:
		ans = ans + 1
		c1 += 1
		c -= 1
	print(c1)
	total -= 1


I = input
for _ in [0] * int(I()):
	y = 1
	zero = 0
	n = I()
	s = list(map(int, I().split()))
	x = sum(s)
	for i in range(len(s)):
		if s[i] == 0:
			zero += 1
			x += 1
	if x == 0:
		zero += 1
	print(zero)


n = int(input())
for _ in range(n):
	a = int(input())
	arr = list(map(int, input().split()))
	k = arr.count(0)
	summ = sum(arr)
	if k + summ == 0:
		print(k + 1)
	else:
		print(k)


a = int(input())
z = []
for i in range(a):
	b = int(input())
	c = list(map(int, input().split()))
	S = 0
	count = 0
	for j in range(b):
		S = S + c[j]
		if c[j] == 0:
			count += 1
			S += 1
	if S == 0:
		count += 1
	z.append(count)
for i in z:
	print(i)


n = int(input())
l = list()
for i in range(n):
	m = input()
	l = input()
	p = 0
	suma = 0
	for j in l.split():
		if int(j) == 0:
			suma += 1
			p += 1
		else:
			suma += int(j)
	if suma == 0:
		p += 1
	print(p)


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	a = list(map(int, input().split()))
	x = a.count(0)
	c = 0
	for i in range(n):
		if a[i] == 0:
			a[i] += 1
			c += 1
	while sum(a) == 0:
		for i in range(n):
			if a[i] > 0:
				a[i] += 1
				c += 1
				break
	print(c)


def main():
	t = int(input())
	for __ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		change = 0
		for i in range(n):
			if a[i] == 0:
				a[i] = 1
				change += 1
		if sum(a) != 0:
			print(change)
		else:
			change += 1
			print(change)
main()


for i in range(int(input())):
	n = int(input())
	a = [int(s) for s in input().split()]
	k = 0
	s = 0
	for j in a:
		if j == 0:
			k += 1
			s += 1
		else:
			s += j
	print(k + (1 if s == 0 else 0))


n = int(input())
l = []
arrays = []
rezult = 0
for i in range(n):
	l.append(int(input()))
	arrays.append(list(map(int, input().split())))
for el in arrays:
	rezult = 0
	if 0 in el:
		for i in el:
			if i == 0:
				el[el.index(i)] = 1
				rezult += 1
	if sum(el) == 0:
		rezult += 1
	print(rezult)


n_samples = input()
V = []
for i in range(int(n_samples)):
	n = input()
	V.append(list(map(int, input().split(' '))))
for v in V:
	S = 0
	count = 0
	G_count = 0
	for (idx, number) in enumerate(v):
		if number == 0:
			v[idx] += 1
			G_count += 1
			zero_idx = idx
			count += 1
		S += number
	S += count
	if S == 0:
		G_count += 1
	print(G_count)


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def IS():
	return sys.stdin.readline()[:-1]

def II():
	return int(sys.stdin.readline())

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

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

def LI1():
	return list(map(int1, sys.stdin.readline().split()))

def LII(rows_number):
	return [II() for _ in range(rows_number)]

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def LLI1(rows_number):
	return [LI1() for _ in range(rows_number)]

def main():
	t = II()
	for _ in range(t):
		n = II()
		A = LI()
		ans = 0
		total = sum(A)
		for i in range(n):
			if A[i] == 0:
				ans += 1
				total += 1
				A[i] = 1
		if total == 0:
			ans += 1
		print(ans)
main()


for _ in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	s = sum(arr)
	z = 0
	for i in arr:
		if i == 0:
			z += 1
	if s + z == 0:
		print(z + 1)
	else:
		print(z)


ans = []
for TC in range(int(input())):
	n = int(input())
	array = list(map(int, input().split()))
	zeros = array.count(0)
	s = sum(array)
	s += zeros
	if s == 0:
		zeros += 1
	ans.append(str(zeros))
print('\n'.join(ans))


def solve():
	cnt0 = summ = 0
	n = int(input())
	qwe = list(map(int, input().split()))
	for i in range(len(qwe)):
		if qwe[i] == 0:
			cnt0 += 1
		summ += qwe[i]
	if summ + cnt0 == 0:
		cnt0 += 1
	print(cnt0)
q = int(input())
for i in range(q):
	solve()


import sys
tests = int(sys.stdin.readline())
for _ in range(tests):
	n = int(sys.stdin.readline())
	arr = list(map(int, sys.stdin.readline().split()))
	prod = 1
	for i in range(n):
		prod *= arr[i]
	ss = sum(arr)
	if prod != 0 and ss != 0:
		print(0)
	else:
		count_0 = 0
		for i in range(n):
			if arr[i] == 0:
				count_0 += 1
		ss += count_0
		if ss == 0:
			summ = abs(1 - abs(ss))
			print(summ + count_0)
		else:
			print(count_0)


for tc in range(int(input())):
	n = int(input())
	lis = [int(i) for i in input().split()]
	prod = 1
	ans = 0
	for i in lis:
		prod *= i
	if prod == 0:
		ans = lis.count(0)
		for i in range(n):
			if lis[i] == 0:
				lis[i] = 1
	s = 0
	for i in lis:
		s += i
	if s == 0:
		ans += 1
	print(ans)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	z = a.count(0)
	s = sum(a)
	ans = z
	if s + ans == 0:
		ans += 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	ls = [int(x) for x in input().split()]
	ans = 0
	for i in range(len(ls)):
		if ls[i] == 0:
			ls[i] += 1
			ans += 1
	su = 0
	product = 1
	for i in ls:
		su += i
		product *= i
	if su == 0:
		for i in range(len(ls)):
			if ls[i] > 0:
				ls[i] += 1
				ans += 1
				break
	print(ans)


import sys
import math
input = sys.stdin.readline

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

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

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

def invr():
	return map(int, input().split())
t = inp()
for _ in range(t):
	n = inp()
	ara = inara()
	zero = 0
	tot = 0
	for num in ara:
		tot += num
		if num == 0:
			zero += 1
	move = zero
	tot += zero
	if tot == 0:
		move += 1
	print(move)


for _ in range(int(input())):
	n = int(input())
	x = 0
	a = [int(i) for i in input().split()]
	for i in range(n):
		if a[i] == 0:
			a[i] += 1
			x += 1
	if sum(a) == 0:
		x += 1
	print(x)


def solve(l):
	r = 0
	s = 0
	for i in range(len(l)):
		s += l[i]
		if l[i] == 0:
			r += 1
			l[i] += 1
			s += 1
	if s == 0:
		for i in range(len(l)):
			if l[i] > 0:
				r += 1
				l[i] += 1
				break
	return r
t = int(input())
for i in range(t):
	l = []
	n = int(input())
	l = list(map(int, input().split()))
	print(solve(l))


def a():
	t = int(input())
	for i in range(t):
		n = int(input())
		l = [int(x) for x in input().split()]
		print(solve(l))

def solve(l=None):
	if l is None:
		return 0
	nb_zeros = sum([1 if x == 0 else 0 for x in l])
	s = sum(l)
	if nb_zeros + s == 0:
		return nb_zeros + 1
	return nb_zeros
a()


n = int(input())
Result = []
for i in range(0, n):
	zero_count = 0
	len_ = int(input())
	List = list(map(int, input().strip().split()))[0:len_]
	for j in List:
		if j == 0:
			zero_count += 1
	Sum = sum(List)
	if Sum == 0:
		if zero_count > 0:
			Result.append(zero_count)
		elif zero_count == 0:
			Result.append(1)
	elif Sum > 0:
		if zero_count > 0:
			Result.append(zero_count)
		elif zero_count == 0:
			Result.append(0)
	elif Sum < 0:
		if zero_count > 0:
			if zero_count == -1 * Sum:
				Result.append(zero_count + 1)
			else:
				Result.append(zero_count)
		elif zero_count == 0:
			Result.append(0)
for i in Result:
	print(i)


import sys
t = int(sys.stdin.readline().rstrip())
for _ in range(t):
	n = int(sys.stdin.readline().rstrip())
	s = list(map(int, sys.stdin.readline().rstrip().split()))
	ceros = 0
	su = 0
	sol = 0
	for item in s:
		if item == 0:
			ceros += 1
		su += item
	sol += ceros
	su += ceros
	if su == 0:
		sol += 1
	print(sol)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

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

def li():
	return list(mi())
import math
for i in range(ii()):
	n = ii()
	a = li()
	c = 0
	for i in range(n):
		if a[i] == 0:
			a[i] += 1
			c += 1
	if sum(a) == 0:
		c += 1
	print(c)


t = int(input())
for _ in range(t):
	_ = input()
	s = list(map(int, input().split()))
	count = 0
	while 0 in s:
		i = s.index(0)
		s[i] = 1
		count += 1
	i = 0
	while sum(s) == 0:
		if s[i] > 0:
			s[i] = s[i] + 1
			count += 1
		else:
			i += 1
	print(count)


R = lambda : list(map(int, input().split()))
for _ in range(int(input())):
	input()
	a = R()
	(z, s) = (a.count(0), sum(a))
	print(z + (z + s == 0))


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = sum(a)
	pro = 1
	for i in range(n):
		pro = pro * a[i]
	if pro != 0 and s != 0:
		print(0)
	else:
		count = 0
		for i in range(n):
			if a[i] == 0:
				count += 1
		s += count
		if s == 0:
			flag = 0
			for i in range(n):
				if a[i] != -1:
					flag = 1
					count += 1
					break
			if flag == 0:
				count += 2
		print(count)


from sys import stdin
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def lsi():
	x = list(stdin.readline())
	x.pop()
	return x

def si():
	return stdin.readline()

def sieve(x):
	a = [True] * (x + 1)
	sq = floor(sqrt(x))
	for i in range(3, sq + 1, 2):
		if a[i]:
			for j in range(i * i, x + 1, i):
				a[j] = False
	if x > 1:
		p = [2]
	else:
		p = []
	for i in range(3, x + 1, 2):
		if a[i]:
			p.append(i)
	return p

def prime_factor(x):
	p = sieve(ceil(sqrt(x))) + [100000000]
	a = []
	i = 0
	while p[i] * p[i] <= x:
		if not x % p[i]:
			a.append(p[i])
			x //= p[i]
		else:
			i += 1
	if x > 1:
		a.append(x)
	return a
res = ['YES', 'NO']
for _ in range(ii()):
	n = ii()
	a = li()
	z = a.count(0)
	if sum(a) + z == 0:
		z += 1
	print(z)


def product(arr):
	result = 1
	for x in arr:
		result = result * x
	return result
for i in range(int(input())):
	a = int(input())
	arr = list(map(int, input().split()))
	if (sum(arr) and product(arr)) != 0:
		print(0)
	else:
		c = arr.count(0)
		if c == 0:
			print(1)
		elif sum(arr) + c == 0:
			print(c + 1)
		else:
			print(c)


q = int(input())
for i in range(q):
	n = int(input())
	l = list(map(int, input().split()))
	x = 0
	s = 0
	for e in l:
		if e == 0:
			x += 1
		else:
			s += e
	s += x
	if s == 0:
		x += 1
	print(x)


t = int(input())
for _ in range(t):
	n = int(input())
	s = list(map(int, input().split()))
	total = sum(s)
	pro = 1
	for i in range(n):
		pro = pro * s[i]
	if pro != 0 and total != 0:
		print(0)
	elif total == 0 and pro == 0:
		print(s.count(0))
	elif total == 0:
		print(1)
	else:
		p = s.count(0)
		for j in range(n):
			if s[j] == 0:
				s[j] += 1
		if sum(s) == 0:
			print(p + 1)
		else:
			print(p)


n = int(input())
for i in range(n):
	s = int(input())
	t = [int(k) for k in input().split()]
	if t.count(0) > 0 and sum(t) + t.count(0) == 0:
		print(t.count(0) + 1)
	elif t.count(0) > 0:
		print(t.count(0))
	elif t.count(0) == 0 and sum(t) == 0:
		print(1)
	else:
		print(0)


t = int(input())
for i in range(t):
	l = int(input())
	s = [int(x) for x in input().split()]
	p = 1
	a = 0
	c = 0
	for j in range(l):
		if s[j] == 0:
			s[j] = 1
			c += 1
	for y in range(l):
		a = a + s[y]
	if a == 0:
		for k in range(l):
			s[k] += 1
			c += 1
			for h in range(l):
				a += s[h]
			if p != 0 and a != 0:
				break
		print(c)
	else:
		print(c)


for sohol in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	rslt = 0
	for i in range(n):
		if a[i] == 0:
			rslt += 1
			a[i] += 1
	if sum(a) == 0:
		rslt += 1
	print(rslt)


ans = 0
for i in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	p = 0
	ans = b.count(0)
	for j in range(a):
		if b[j] == 0:
			b[j] = 1
		p += b[j]
	if p == 0:
		print(ans + 1)
	else:
		print(ans)


t = int(input())
n = 0
a = []
s = 0
c = 0
for z in range(t):
	s = 0
	c = 0
	n = int(input())
	a = input().split()
	for i in range(n):
		s += int(a[i])
		if a[i] == '0':
			c += 1
	if s + c != 0:
		print(c)
	else:
		print(c + 1)


x = int(input())
mst = []
for i in range(0, x):
	c = int(input())
	d = list(map(int, input().split()))
	lst = [index for (index, element) in enumerate(d) if element == 0]
	count = 0
	for i in lst:
		count += 1
		d[i] = 1
	c = sum(d)
	if c == 0:
		count += 1
	mst.append(count)
print(*mst, sep='\n')


for _ in range(int(input())):
	N = int(input())
	L = list(map(int, input().split()))
	neg = 0
	pos = 0
	zero = 0
	for i in L:
		if i < 0:
			neg += i
		elif i > 0:
			pos += i
		else:
			zero += 1
	ans = zero
	pos = pos + zero
	if pos + neg == 0:
		ans += 1
	print(ans)


q = int(input())
for w in range(q):
	n = int(input())
	arr = input().split()
	ans = 0
	sum = 0
	for i in range(len(arr)):
		arr[i] = int(arr[i])
		if arr[i] == 0:
			ans += 1
		else:
			sum += arr[i]
	if ans == sum * -1:
		print(ans + 1)
	elif ans > 0:
		print(ans)
	elif sum == 0:
		print(1)
	else:
		print(0)


from math import factorial
from collections import Counter
from heapq import heapify, heappop, heappush
from sys import stdin

def RL():
	return map(int, stdin.readline().rstrip().split())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 1000000007
N = int(input())
for _ in range(N):
	n = int(input())
	arr = list(RL())
	sm = 0
	zeros = 0
	for i in arr:
		if i == 0:
			zeros += 1
		sm += i
	if zeros == 0:
		if sm != 0:
			print(0)
		else:
			print(1)
	elif zeros + sm == 0:
		print(zeros + 1)
	else:
		print(zeros)


for tc in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	curr_sum = 0
	steps = 0
	for i in range(n):
		if l[i] == 0:
			steps += 1
			curr_sum += 1
		curr_sum += l[i]
	if curr_sum != 0:
		print(steps)
	else:
		print(steps + 1)


def result(n, arr):
	zero = 0
	s = 0
	for i in arr:
		s += i
		if i == 0:
			zero += 1
	if s != 0 and zero == 0:
		return 0
	elif s > 0 and zero != 0:
		return zero
	elif s == 0 and zero == 0:
		return 1
	elif s < 0 and abs(s) == zero:
		return zero + 1
	else:
		return zero

def main():
	for _ in range(int(input())):
		n = int(input())
		arr = list(map(int, input().split(' ')))
		print(result(n, arr))
main()


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	arr = list(map(int, sys.stdin.readline().split()))
	ans = 0
	for i in range(n):
		if arr[i] == 0:
			arr[i] += 1
			ans += 1
	if sum(arr) == 0:
		ans += 1
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	x = input()
	x = x.split(' ')
	arr = []
	for j in x:
		arr.append(int(j))
	steps = 0
	for j in range(len(arr)):
		if arr[j] == 0:
			arr[j] = 1
			steps += 1
	sum = 0
	for j in arr:
		sum += j
	if sum == 0:
		steps += 1
	print(steps)


import math

def main():
	n = int(input())
	a = list(map(int, input().split()))
	sum = 0
	zero = 0
	for i in a:
		sum += i
		if i == 0:
			zero += 1
	used = 0
	if zero != 0:
		sum += zero
		used += zero
	if sum == 0:
		used += 1
	print(used)
t = int(input())
for i in range(t):
	main()


def init():
	n_cases = int(input())
	for i in range(0, n_cases):
		list_size = input()
		curr_list = input().split(' ')
		for j in range(0, len(curr_list)):
			curr_list[j] = int(curr_list[j])
		print(solve_case(curr_list))

def solve_case(num_list):
	steps = 0
	for i in range(0, len(num_list)):
		if num_list[i] == 0:
			num_list[i] += 1
			steps += 1
	if sum(num_list) == 0:
		steps += 1
	return steps
init()


exec(int(input()) * 'n,a=int(input()),list(map(int,input().split()));j=a.count(0);s=sum(a)+j;print(j+1) if s==0 else print(j);')


t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	cntZeros = 0
	s = 0
	arr = input().split()
	for i in range(n):
		arr[i] = int(arr[i])
		if arr[i] == 0:
			cntZeros += 1
		s += arr[i]
	if s + cntZeros == 0:
		cntZeros += 1
	ans.append(cntZeros)
for i in range(t):
	print(ans[i])


from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from functools import *
from itertools import permutations, combinations, groupby
import sys
import bisect
import string
import math
import time
import random

def Golf():
	(*a,) = map(int, open(0))

def S_():
	return input()

def IS():
	return input().split()

def LS():
	return [i for i in input().split()]

def I():
	return int(input())

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

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def StoI():
	return [ord(i) - 97 for i in input()]

def ItoS(nn):
	return chr(nn + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def GI(V, E, Directed=False, index=0):
	org_inp = []
	g = [[] for i in range(n)]
	for i in range(E):
		inp = LI()
		org_inp.append(inp)
		if index == 0:
			inp[0] -= 1
			inp[1] -= 1
		if len(inp) == 2:
			(a, b) = inp
			g[a].append(b)
			if not Directed:
				g[b].append(a)
		elif len(inp) == 3:
			(a, b, c) = inp
			aa = (inp[0], inp[2])
			bb = (inp[1], inp[2])
			g[a].append(bb)
			if not Directed:
				g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}):
	mp = [1] * (w + 2)
	found = {}
	for i in range(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [1] + [mp_def[j] for j in s] + [1]
	mp += [1] * (w + 2)
	return (h + 2, w + 2, mp, found)

def bit_combination(k, n=2):
	rt = []
	for tb in range(n ** k):
		s = [tb // n ** bt % n for bt in range(k)]
		rt += [s]
	return rt

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
YN = ['YES', 'NO']
mo = 10 ** 9 + 7
inf = float('inf')
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
input = lambda : sys.stdin.readline().rstrip()

def ran_input():
	import random
	n = random.randint(4, 16)
	(rmin, rmax) = (1, 10)
	a = [random.randint(rmin, rmax) for _ in range(n)]
	return (n, a)
t = I()
for _ in range(t):
	n = I()
	a = LI()
	c = a.count(0)
	if c > 0:
		if sum(a) + c == 0:
			c += 1
		print(c)
	elif sum(a) == 0:
		print(1)
	else:
		print(0)


for u in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(x, y) = (0, 0)
	for i in range(n):
		if l[i] == 0:
			x = x + 1
			l[i] = 1
	for i in range(n):
		y = y + l[i]
	if y == 0:
		x = x + 1
	print(x)


t = int(input())
for i1 in range(t):
	steps = int(0)
	index_cons = int(0)
	sum = int(0)
	nesum = int(0)
	n = int(input())
	lst = list(map(int, input().split()))
	i = int(0)
	for i in lst:
		new = int(i)
		if new == 0:
			new = new + 1
			steps += 1
		sum += new
		nesum *= new
	if sum == 0:
		steps += 1
	print(steps)


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	answer = 0
	currentsum = sum(a)
	for x in a:
		if x == 0:
			answer += 1
			currentsum += 1
	if currentsum == 0:
		answer += 1
	print(answer)


import sys
t = int(input())
for i in range(t):
	n = int(input())
	arr = eval(input().replace(' ', ','))
	if type(arr) is int:
		arr = [arr]
	zero_num = 0
	sum = 0
	for i in arr:
		if not i:
			zero_num += 1
			sum += i + 1
		else:
			sum += i
	if not sum:
		zero_num += 1
	print(zero_num)
	sys.stdout.flush()


t = int(input())
result = ''
for i in range(t):
	n = int(input())
	x = list(map(int, input().split()))
	count = 0
	while 0 in x:
		i = x.index(0)
		x[i] += 1
		count += 1
	if sum(x) == 0:
		for j in range(n):
			if x[j] != -1:
				x[j] += 1
				count += 1
				break
	result += str(count) + '\n'
print(result)


t = int(input())
for i in range(t):
	n = int(input())
	cnt = 0
	l = list(map(int, input().split()))
	for j in range(n):
		if l[j] == 0:
			l[j] = 1
			cnt = cnt + 1
	if sum(l) == 0:
		cnt = cnt + 1
	print(cnt)


for t in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split()]
	zero = 0
	ssum = 0
	for i in l:
		ssum += i
		if not i:
			zero += 1
	res = zero
	if ssum + zero == 0:
		res += 1
	print(res)


def mult(l):
	ans = 1
	for x in l:
		ans = ans * x
	return ans
T = int(input())
for t in range(T):
	n = int(input())
	cnt = 0
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	while sum(l) == 0 or mult(l) == 0:
		while mult(l) == 0:
			l[l.index(0)] += 1
			cnt += 1
		while sum(l) == 0:
			l[0] += 1
			cnt += 1
	print(cnt)


t1 = int(input())
for _ in range(t1):
	n = int(input())
	a = list(map(int, input().split()))
	l = a.count(0)
	p = 0
	if sum(a) == 0:
		p = 1
	if sum(a) + l == 0:
		l += 1
	print(max(l, p))


def main():
	n = int(input())
	arr = [int(i) for i in input().split(' ')]
	arr_sum = sum(arr)
	zeros = len([i for i in arr if i == 0])
	if -1 * arr_sum == zeros:
		print(zeros + 1)
		return
	print(max(0, zeros))
for _ in range(int(input())):
	main()


n = int(input())
res = []
for i in range(n):
	n1 = int(input())
	nums = input().split()
	nums = list(map(int, nums))
	c1 = nums.count(0)
	c2 = c1 + sum(nums)
	if c2 == 0:
		c1 += 1
	res.append(c1)
	c1 = 0
for p in res:
	print(p)


def nonZero(liste):
	c = liste.count(0)
	for i in range(len(liste)):
		if liste[i] == 0:
			liste[i] = 1
		else:
			pass
	if sum(liste) > 0:
		pass
	elif sum(liste) == 0:
		c += 1
	elif sum(liste) > 0:
		c += -1 * sum(liste)
	return c
b = []
n = int(input())
for i in range(n):
	e = int(input())
	liste = [int(z) for z in input().split()]
	b.append(nonZero(liste))
for i in b:
	print(i)


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


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().strip().split()))[:n]
	res = 0
	while a.count(0) > 0:
		a[a.index(0)] = 1
		res += 1
	if sum(a) == 0:
		res += 1
	print(res)


t = int(input())
for i in range(t):
	n = int(input())
	ar = [int(x) for x in input().split()]
	pos = 0
	neg = 0
	zr = 0
	for j in ar:
		if j < 0:
			neg += j
		elif j > 0:
			pos += j
		else:
			zr += 1
	if zr == 0 and neg + pos != 0:
		print('0')
	elif abs(neg) == abs(pos) and zr == 0:
		print('1')
	elif zr != 0:
		if abs(neg) > abs(pos) and abs(neg) - abs(pos) == zr:
			print(zr + 1)
		elif abs(neg) > abs(pos):
			print(zr)
		elif abs(pos) > abs(neg):
			print(zr)
		elif abs(neg) == abs(pos):
			print(zr)


for i in range(int(input())):
	am = int(input())
	arr = list(map(int, input().split()))
	c = 0
	s = arr.count(0)
	if sum(arr) + s == 0:
		print(s + 1)
	else:
		print(s)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(c) for c in input().split()]
	res = 0
	s = 0
	for i in range(n):
		if a[i] == 0:
			res += 1
			a[i] = 1
		s += a[i]
	if s == 0:
		res += 1
	print(res)


t = int(input())
for _ in range(t):
	n = int(input())
	liste = list(map(int, input().split()))
	moves = 0
	sume = 0
	zero = 0
	for j in range(n):
		if liste[j] == 0:
			zero += 1
			liste[j] += 1
		sume += liste[j]
	if sume == 0:
		print(zero + 1)
	else:
		print(zero)


n_sets = int(input())
for _ in range(n_sets):
	n = int(input())
	arr = list(map(int, input().split()))
	s_arr = sum(arr)
	nz = arr.count(0)
	if nz > 0:
		if s_arr + nz == 0:
			print(nz + 1)
		else:
			print(nz)
	elif s_arr == 0:
		print(1)
	else:
		print(0)


for i in range(int(input())):
	n = int(input())
	ans = 0
	x = [int(w) for w in input().split()]
	if 0 in x:
		ans += x.count(0)
		if sum(x) + x.count(0) == 0:
			ans += 1
		print(ans)
	elif sum(x) == 0:
		print(1)
	else:
		print(0)


T = int(input())
for i in range(T):
	N = int(input())
	numbers = list(map(lambda x: int(x), input().split(' ')))
	minimum_operations_needed = 0
	for j in range(len(numbers)):
		if numbers[j] == 0:
			numbers[j] = 1
			minimum_operations_needed += 1
	if sum(numbers) != 0:
		print(minimum_operations_needed)
	else:
		minimum_operations_needed += 1
		print(minimum_operations_needed)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	count = 0
	sum = 0
	flag = 0
	for i in a:
		if i != -1:
			flag = 1
		if i == 0:
			count += 1
			sum += 1
		else:
			sum += i
	if sum == 0:
		if flag == 1:
			print(count + 1)
		else:
			print(count + 2)
	else:
		print(count)


def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		S = 0
		z = 0
		for i in range(n):
			if a[i] == 0:
				z += 1
			else:
				S += a[i]
		if S + z == 0:
			z += 1
		print(z)
main()


import sys
r_input = sys.stdin.readline
for _ in range(int(r_input())):
	n = int(r_input())
	A = list(map(int, r_input().split()))
	total = sum(A)
	if 0 not in A and total:
		print(0)
	elif 0 in A:
		tmp = A.count(0)
		if total + tmp == 0:
			print(tmp + 1)
		else:
			print(tmp)
	else:
		print(1)


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	ANS = 0
	for i in range(n):
		if A[i] == 0:
			A[i] = 1
			ANS += 1
	if sum(A) == 0:
		ANS += 1
	print(ANS)


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

def _input():
	return int(input())

def main():
	answer = ''
	for test in range(_input()):
		n = _input()
		integers = _listinput()
		changes = 0
		for i in range(len(integers)):
			if integers[i] == 0:
				integers[i] = 1
				changes += 1
		sm = sum(integers)
		if sm == 0:
			changes += 1
		answer += str(changes) + '\n'
		pass
	print(answer)
main()


def calc(A):
	(sum_, steps) = (0, 0)
	for a in A:
		if a == 0:
			a += 1
			steps += 1
		sum_ += a
	return steps if sum_ != 0 else steps + 1
N = int(input())
cases = []
for _ in range(N):
	_ = input()
	cases.append(list(map(int, input().split())))
for case in cases:
	print(calc(case))


def mul(an):
	pr = 1
	for i in an:
		pr *= i
	return pr
t = int(input())
for j in range(t):
	n = int(input())
	an = list(map(int, input().rstrip().split()))
	san = sum(an)
	man = mul(an)
	r = an.count(0)
	if san == -r and man == 0:
		r += 1
		print(r)
	elif san == 0 and man != 0:
		r = 1
		print(r)
	elif san == 0 and man == 0:
		r = an.count(0)
		print(r)
	elif san != 0 and man == 0:
		print(r)
	else:
		r = 0
		print(r)


for _ in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	steps = 0
	for i in range(n):
		if arr[i] == 0:
			arr[i] = 1
			steps += 1
	if sum(arr) == 0:
		steps += 1
	print(steps)


T = int(input())
for _ in range(0, T):
	N = int(input())
	s = [int(x) for x in input().split()]
	tot = 0
	c = 0
	for i in range(0, len(s)):
		tot += s[i]
		if s[i] == 0:
			c += 1
	if c == 0:
		if tot == 0:
			print(1)
		else:
			print(0)
	elif tot + c == 0:
		print(c + 1)
	else:
		print(c)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	w = sum(a)
	if w == 0:
		print(max(1, a.count(0)))
	elif w < 0:
		if a.count(0) == abs(w):
			print(abs(w) + 1)
		else:
			print(a.count(0))
	else:
		print(a.count(0))


def examA():
	t = I()
	ans = []
	for _ in range(t):
		n = I()
		A = LI()
		cur = 0
		for a in A:
			if a == 0:
				cur += 1
		if cur + sum(A) == 0:
			cur += 1
		ans.append(cur)
	for v in ans:
		print(v)
	return

def examB():
	ans = 0
	print(ans)
	return

def examC():
	ans = 0
	print(ans)
	return

def examD():
	ans = 0
	print(ans)
	return

def examE():
	ans = 0
	print(ans)
	return

def examF():
	ans = 0
	print(ans)
	return
import sys, copy, bisect, itertools, heapq, math, random
from heapq import heappop, heappush, heapify
from collections import Counter, defaultdict, deque

def I():
	return int(sys.stdin.readline())

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

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

def LS():
	return sys.stdin.readline().split()

def SI():
	return sys.stdin.readline().strip()
global mod, mod2, inf, alphabet, _ep
mod = 10 ** 9 + 7
mod2 = 998244353
inf = 10 ** 18
_ep = 10 ** (-12)
alphabet = [chr(ord('a') + i) for i in range(26)]
examA()


t = int(input())
for i in range(t):
	input()
	a = [*map(int, input().split())]
	c = a.count(0)
	s = sum(a)
	if s == 0 and c == 0:
		ans = 1
	elif c != 0:
		ans = c
		if -1 * s == c:
			ans += 1
	else:
		ans = 0
	print(ans)


def find_steps(elements, steps):
	sum_elem = sum(elements)
	index_of_zero = -1
	for i in elements:
		if i == 0:
			index_of_zero = elements.index(i)
			elements[index_of_zero] = elements[index_of_zero] + 1
			sum_elem = sum_elem + 1
			steps = steps + 1
	if sum_elem != 0:
		return steps
	else:
		return steps + 1
t = int(input())
for tests in range(t):
	n = int(input())
	elements = list(map(int, input().split(' ')))
	steps = 0
	print(find_steps(elements, steps))


t = int(input())
for bla in range(t):
	n = int(input())
	count = 0
	lis = list(map(int, input().split()))
	for i in range(len(lis)):
		if lis[i] == 0:
			lis[i] += 1
			count += 1
	if sum(lis) == 0:
		count += 1
	print(count)


n = int(input())
for i in range(n):
	x = int(input())
	arr = list(map(int, input().split()))
	st = 0
	s1 = sum(arr)
	pt = 1
	for i in range(x):
		pt = pt * arr[i]
	if pt != 0 and s1 != 0:
		print(0)
	elif pt == 0:
		c0 = arr.count(0)
		if c0 + s1 == 0:
			print(c0 + 1)
		else:
			print(c0)
	else:
		print(1)


k = int(input())
s = 0
for x in range(k):
	s = 0
	p = int(input())
	a = list(map(int, input().strip().split()[:p]))
	if all(a) == True:
		if sum(a) != 0:
			print(0)
		else:
			print(1)
	elif sum(a) != 0:
		for x in a:
			if x == 0:
				s += 1
		if sum(a) + s == 0:
			print(s + 1)
		else:
			print(s)
	else:
		for x in a:
			if x == 0:
				s += 1
		if sum(a) + s == 0:
			print(s + 1)
		else:
			print(s)


t = int(input())
for l in range(t):
	input()
	ls = list(map(int, input().split()))
	if ls.count(0) == 0 and sum(ls) == 0:
		print(1)
	elif ls.count(0) != 0 and sum(ls) != -ls.count(0):
		print(ls.count(0))
	elif ls.count(0) != 0 and sum(ls) == -ls.count(0):
		print(ls.count(0) + 1)
	else:
		print(0)


T = int(input())
for i in range(T):
	n = int(input())
	a = list(map(int, input().split(' ')))
	sm = sum(a)
	cnt0 = 0
	for i in range(len(a)):
		if a[i] == 0:
			cnt0 += 1
	if sm == 0:
		if cnt0 == 0:
			print(1)
		else:
			print(cnt0)
	elif sm > 0:
		print(cnt0)
	elif cnt0 == -sm:
		print(-sm + 1)
	else:
		print(cnt0)


t = int(input())
for T in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	prod = 1
	summ = 0
	count = 0
	for i in a:
		prod *= i
		summ += i
	if summ != 0 and prod != 0:
		print(0)
	elif prod == 0:
		for i in a:
			if i == 0:
				count += 1
		if summ + count == 0:
			print(count + 1)
		else:
			print(count)
	elif summ == 0 and prod != 0:
		print(1)


test_cases = int(input())

def nonZeroProduct(arr):
	return arr.count(0)

def nonZeroSum(arr):
	total = sum(arr) + nonZeroProduct(arr)
	if total == 0:
		return 1
	return 0

def getMinSteps(arr):
	return nonZeroProduct(arr) + nonZeroSum(arr)
for i in range(test_cases):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	print(getMinSteps(arr))


t = int(input())
for i in range(t):
	input()
	arr = list(map(int, input().split()))
	zero = arr.count(0)
	tot = sum(arr) + zero
	print(zero + int(tot == 0))


from collections import defaultdict as dd
import sys
input = sys.stdin.readline
t = int(input())
while t:
	n = int(input())
	l = list(map(int, input().split()))
	res = l.count(0)
	su = 0
	for i in l:
		if i == 0:
			su += 1
		else:
			su += i
	if su == 0:
		res += 1
	print(res)
	t -= 1


def solve(test):
	ans = 0
	sum = 0
	n = int(input())
	a = list(map(int, input().split()))
	for x in a:
		if x == 0:
			x += 1
			ans += 1
		sum += x
	if sum == 0:
		ans += 1
	print(ans)
t = int(input())
for _ in range(t):
	solve(_ + 1)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def sumproductzero():
	for _ in range(t):
		n = int(input())
		(*a,) = [int(x) for x in input().split()]
		n = a.count(0)
		sumall = sum(a) + n
		if sumall == 0:
			yield (n + 1)
		else:
			yield n
t = int(input())
ans = sumproductzero()
print(*ans, sep='\n')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c0 = l.count(0)
	s = sum(l)
	if s < 0:
		ans = c0
		s += c0
		if s == 0:
			ans += 1
	elif s > 0:
		ans = c0
	elif c0:
		ans = c0
	else:
		ans = 1
	print(ans)


t = int(input())
for tc in range(t):
	n = int(input())
	count = 0
	l = list(map(int, input().split()))
	while 0 in l:
		i = l.index(0)
		l[i] += 1
		count += 1
	if sum(l) == 0:
		count += 1
	print(count)


t = int(input())
for i in range(0, t):
	n = int(input())
	l = list(map(int, input().split()))
	p = 0
	q = 0
	z = 0
	d = 0
	for j in range(0, len(l)):
		if l[j] == 0:
			l[j] = l[j] + 1
			d = d + 1
	while sum(l) == 0:
		l[0] = l[0] + 1
		d = d + 1
	print(d)


import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
from functools import lru_cache
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

def input():
	return sys.stdin.readline()

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
for _ in range(int(input())):
	n = int(input())
	a = list(mapi())
	res = 0
	sm = sum(a)
	pd = 1
	res += a.count(0)
	for i in range(n):
		pd *= a[i]
	if sm != 0 and pd != 0:
		print(0)
		continue
	sm += res
	if sm == 0:
		res += 1
	print(res)


def solve(n, arr):
	ans = 0
	arrSum = sum(arr)
	for num in arr:
		if num == 0:
			arrSum += 1
			ans += 1
	if arrSum == 0:
		ans += 1
	return ans
t = int(input())
for i in range(t):
	n = input()
	arr = list(map(int, input().split()))
	print(solve(n, arr))


for i in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	s = 0
	ct = 0
	for j in range(len(b)):
		if b[j] == 0:
			ct += 1
			b[j] += 1
	for j in b:
		s += j
	if s == 0:
		b[0] += 1
		ct += 1
	print(ct)


for i in range(int(input())):
	tamanho = int(input())
	arrey = input().split()
	contador = 0
	if str(0) in arrey:
		while True:
			if str(0) in arrey:
				posicao = arrey.index(str(0))
				arrey[posicao] = 1
				contador = contador + 1
			else:
				break
	arrey_mod = map(int, arrey)
	soma = sum(arrey_mod)
	if soma == 0:
		contador = contador + 1
	print(contador)


for i in range(int(input())):
	n = int(input())
	x = [int(q) for q in input().split()]
	y = x[:]
	c = 0
	for j in range(len(x)):
		if y[j] == 0:
			c += 1
			y[j] = 1
	if sum(y) == 0:
		c += 1
	print(c)


t = int(input())
while t:
	n = int(input())
	l = list(map(int, input().split(' ')))
	op = 0
	op += l.count(0)
	if op != 0:
		if sum(l) + op == 0:
			op += 1
	elif sum(l) == 0:
		op += 1
	print(op)
	t -= 1


def solve(A, n):
	cnt = 0
	for i in range(n):
		if A[i] == 0:
			A[i] += 1
			cnt += 1
	if sum(A) == 0:
		cnt += 1
	return cnt
res = []
t = int(input())
while t:
	n = int(input())
	arr = input().split(' ')
	A = [int(n) for n in arr]
	res.append(solve(A, n))
	t -= 1
for r in res:
	print(r)


k = []
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if sum(a) + a.count(0) == 0:
		k.append(1 + a.count(0))
	else:
		k.append(a.count(0))
for i in k:
	print(i)


t = int(input())
while t:
	t -= 1
	n = int(input())
	arr = [int(s) for s in input().split()]
	s = sum(arr)
	m = 1
	for i in arr:
		m = m * i
	if m != 0 and s != 0:
		print(0)
	elif m != 0 and s == 0:
		print(1)
	elif m == 0 and s != 0:
		count_zero = 0
		for i in arr:
			if i == 0:
				count_zero += 1
		if count_zero + s != 0:
			print(count_zero)
		else:
			print(count_zero + 1)
	else:
		count_zero = 0
		for i in arr:
			if i == 0:
				count_zero += 1
		print(count_zero)


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	p = sum(a)
	f = a.count(0)
	if f == 0 and p == 0:
		print(1)
		continue
	res = 0
	res += f
	if f + p == 0:
		print(res + 1)
	else:
		print(res)


t = int(input().strip())
for q in range(0, t):
	n = int(input().strip())
	arr = list(map(int, input().strip(' ').split(' ')))
	count = 0
	sum_val = sum(arr)
	zero = arr.count(0)
	if sum_val != 0 and zero == 0:
		print(0)
	else:
		for i in range(0, n):
			if arr[i] == 0:
				arr[i] += 1
				count += 1
				sum_val += 1
		if sum_val != 0:
			print(count)
		else:
			print(count + 1)


from sys import stdin, stdout
from math import sqrt

def main():
	for x in stdin:
		t = int(x)
		for i in range(t):
			n = int(input())
			arr = list(map(int, input().split()))
			s = sum(arr)
			c = arr.count(0)
			ans = 0
			if s == 0 and c:
				ans += c
			elif s == 0:
				ans += 1
			elif s + c == 0:
				ans += c + 1
			else:
				ans += c
			print(ans)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	c = 0
	for i in range(n):
		if l[i] == 0:
			l[i] += 1
			c += 1
	s = sum(l)
	if s == 0:
		c += 1
	print(c)


n = int(input().strip())
for i in range(n):
	m = int(input().strip())
	arr = list(map(int, input().strip().split()))[:m]
	sum_arr = sum(arr)
	prod = 1
	ct = 0
	for m in arr:
		if m == 0:
			ct += 1
	if ct != 0:
		sum_arr = sum(arr) + ct
		if sum_arr == 0:
			print(ct + 1)
		else:
			print(ct)
	elif sum_arr == 0:
		print(1)
	else:
		print(0)


n = int(input())

def f(arr):
	s = 0
	res = 0
	for x in arr:
		if x == 0:
			s += x + 1
			res += 1
		else:
			s += x
	if s == 0:
		res += 1
	return res
for _ in range(n):
	input()
	arr = list(map(int, input().split()))
	print(f(arr))


from functools import reduce
import operator

def non_zero(list):
	sum2 = sum(list)
	mule = reduce(operator.mul, list, 1)
	return False if sum2 or mule == 0 else True

def solution():
	for _ in range(int(input())):
		input()
		l = list(map(int, input().split()))
		moves = 0
		while 0 in l:
			idx = l.index(0)
			l[idx] += 1
			moves += 1
		while non_zero(l):
			idx = l.index(max(l))
			l[idx] += 1
			moves += 1
		print(moves)
solution()


import math as m
q = int(input())
for _ in range(q):
	n = int(input())
	l = list(map(int, input().split()))
	ans = 0
	ans += l.count(0)
	if l.count(0) == 0:
		if sum(l) == 0:
			print(1)
		else:
			print(0)
	elif sum(l) + ans == 0:
		print(ans + 1)
	else:
		print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(j) for j in input().split()]
	res = 0
	res += a.count(0)
	t = sum(a)
	t += res
	if t == 0:
		res += 1
	print(res)


q = int(input())
for j in range(0, q):
	n = int(input(''))
	a = list(map(int, input().split()))
	l = sum(a)
	p = 0
	for i in range(0, n):
		if a[i] == 0:
			p += 1
	if p == 0:
		if l == 0:
			print('1')
		else:
			print('0')
	elif p + l != 0:
		print(p)
	elif p + l * -1 == 0:
		print(p)
	else:
		print(p + 1)


from collections import *
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	sn = sum(a)
	d = Counter(a)
	co = d[0]
	k = sn - 0
	if d[0] == 0 and sn == 0:
		print(1)
	elif sn == 0 and d[0] != 0:
		print(d[0])
	elif sn != 0 and d[0] == 0:
		print(0)
	elif sn != 0 and d[0] != 0:
		if k == -d[0]:
			print(d[0] + 1)
		else:
			print(d[0])


t = int(input())

def checkio(n, arr):
	arr_sum = sum(arr)
	res = 0
	res += arr.count(0)
	if arr_sum + res != 0:
		return res
	else:
		while arr_sum + res == 0:
			res += 1
		return res
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	print(checkio(n, arr))


case = int(input())
for caseNum in range(0, case):
	n = int(input())
	numList = [int(x) for x in input().split()]
	answer = 0
	for i in numList:
		if i == 0:
			answer += 1
	if sum(numList) + answer == 0:
		answer += 1
	print(answer)


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline().strip())
pt = lambda x: sys.stdout.write(str(x))
for _ in range(get_int()):
	n = get_int()
	lst = get_int_list()
	count = 0
	for i in range(n):
		if lst[i] == 0:
			count += 1
			lst[i] = 1
	total = sum(lst)
	if total == 0:
		count += 1
	print(count)


import math, sys
from collections import Counter, defaultdict, deque
from sys import stdin, stdout
input = stdin.readline
lili = lambda : list(map(int, sys.stdin.readlines()))
li = lambda : list(map(int, input().split()))
I = lambda : int(input())
S = lambda : input().strip()
mod = 1000000007
for i in range(I()):
	n = I()
	a = li()
	z = a.count(0)
	s = sum(a)
	if z == 0 and s != 0:
		print(0)
	elif z == 0 and s == 0:
		print(1)
	else:
		s += z
		if s == 0:
			print(z + 1)
		else:
			print(z)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	steps = 0
	s = 0
	for (i, a) in enumerate(arr):
		if a == 0:
			arr[i] += 1
			steps += 1
		s += arr[i]
	if s == 0:
		steps += 1
	print(steps)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	countzero = arr.count(0)
	if sum(arr) != 0 and countzero == 0:
		print(0)
	elif sum(arr) == 0 and countzero == 0:
		print(1)
	elif countzero != 0:
		for i in range(len(arr)):
			if arr[i] == 0:
				arr[i] += 1
		if sum(arr) == 0:
			print(countzero + 1)
		else:
			print(countzero)


for I in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	res = a.count(0)
	summ = sum(a) + res
	if summ == 0:
		res += 1
	print(res)


t = int(input())
for i in range(t):
	p = 0
	m = 0
	n = int(input())
	array = map(int, input().split(' '))
	for j in array:
		if j == 0:
			j += 1
			p += 1
		m += j
	if m == 0:
		p += 1
	print(p)


t = int(input())
for _ in range(t):
	s = 0
	input()
	ar = list(map(int, input().split()))
	for i in ar:
		if i == 0:
			s += 1
	k = sum(ar) + s
	if k == 0:
		print(s + 1)
	else:
		print(s)


t = int(input())
for i in range(t):
	k = 0
	su = 0
	n = int(input())
	s = [int(x) for x in input().split()]
	for j in range(len(s)):
		if s[j] == 0:
			k += 1
		su += s[j]
	su += k
	if su == 0:
		k += 1
	print(k)


import os
import sys
from collections import deque, defaultdict
import math

class Pair:

	def __init__(self, x, y):
		self.x = x
		self.y = y
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	negs = 0
	pos = 0
	zeros = 0
	ops = 0
	for num in arr:
		if num > 0:
			pos += num
		if num < 0:
			negs += num
		if num == 0:
			zeros += 1
	if pos > abs(negs) and zeros == 0:
		print(0)
		continue
	if zeros != 0:
		pos += zeros
		ops += zeros
	if pos == abs(negs):
		ops += abs(negs) - pos + 1
	print(ops)


t = int(input())
for k in range(t):
	n = int(input())
	mas = list(map(int, input().split()))
	kol = 0
	for i in range(n):
		if mas[i] == 0:
			mas[i] = 1
			kol += 1
	print(kol + int(sum(mas) == 0))


for _ in range(int(input())):
	n = int(input())
	a = [*map(int, input().split())]
	su = 0
	b = []
	count = 0
	su = 0
	for i in a:
		if i == 0:
			i += 1
			count += 1
		su += i
	if su == 0:
		count += 1
	print(count)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	cost = 0
	num_zero = a.count(0)
	sum_a = sum(a)
	if num_zero > 0:
		cost += num_zero
		sum_a += num_zero
	if sum_a == 0:
		cost += 1
	print(cost)


mod = 10 ** 9 + 7
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	sm = sum(a)
	pro = 1
	for i in a:
		pro *= i
		pro %= mod
	if sm and pro:
		print(0)
	elif sm:
		ans = a.count(0)
		sm += a.count(0)
		if sm == 0:
			ans += 1
		print(ans)
	elif pro:
		print(1)
	else:
		print(a.count(0))


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


import os
import sys
from io import BytesIO, IOBase
import threading
from math import cos, sin, pi

def main():
	for _ in range(int(input())):
		n = int(input())
		arr = list(map(int, input().split()))
		ans = arr.count(0)
		if sum(arr) + ans == 0:
			ans += 1
		print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


inp = input
li = list
iinp = lambda : int(inp())
ent = lambda : map(int, inp().split())
lient = lambda : [int(i) for i in inp().split()]
li0 = lambda x: [0 for i in range(x)]
stent = lambda : [i for i in inp()]
su = sum
mi = min
le = len
t = iinp()
for _ in range(t):
	n = iinp()
	nums = lient()
	zeros = [i for i in nums if i == 0]
	cont = le(zeros)
	if su(nums) + cont == 0:
		cont = cont + 1
	print(cont)


import sys
T = int(sys.stdin.readline())
for i in range(T):
	N = int(sys.stdin.readline())
	nums = list(map(int, sys.stdin.readline().split()))
	answer = 0
	while True:
		for i in range(N):
			if nums[i] == 0:
				nums[i] += 1
				answer += 1
			else:
				pass
		if sum(nums) == 0:
			nums[0] = nums[0] + 1
			answer += 1
		if sum(nums) != 0:
			break
	print(answer)


z = input
from math import ceil, log, gcd, sqrt
n = int(z())
for i in range(n):
	input()
	l = sorted(list(map(int, z().split())))
	t = sum(l)
	zerro = l.count(0)
	ans = 0
	if t != 0 and zerro == 0:
		print(0)
		continue
	t += zerro
	ans += zerro
	if t == 0:
		print(ans + 1)
	else:
		print(ans)


I = input
for _ in range(int(I())):
	n = I()
	a = map(int, input().split())
	m = 0
	k = 0
	for i in a:
		if i == 0:
			i = 1
			k += 1
		m += i
	if m == 0:
		k += 1
	print(k)


import sys
input = sys.stdin.readline
from collections import *
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	p = 1
	zero = 0
	for ai in a:
		p *= ai
		if ai == 0:
			zero += 1
	if p != 0 and sum(a) != 0:
		print(0)
	elif p != 0 and sum(a) == 0:
		print(1)
	elif p == 0 and sum(a) + zero == 0:
		print(zero + 1)
	else:
		print(zero)


for i in [*open(0)][2::2]:
	(a, k) = ([*map(int, i.split())], 0)
	for i in range(len(a)):
		if a[i] == 0:
			k += 1
			a[i] = 1
	if sum(a) == 0:
		k += 1
	print(k)


import sys

class ANonZero:

	def solve(self):
		for _ in range(int(input())):
			n = int(input())
			a = [int(_) for _ in input().split()]
			s = sum(a)
			v = a.count(0)
			ans = v + (1 if s + v == 0 else 0)
			print(ans)
solver = ANonZero()
input = sys.stdin.readline
solver.solve()


t = int(input())
for _ in range(0, t):
	n = int(input())
	a = [int(j) for j in input().split()]
	c = 0
	sum = 0
	for i in range(0, n):
		if a[i] == 0:
			c += 1
		sum += a[i]
	ans = 0
	ans = c
	sum = sum + c
	if sum == 0:
		ans += 1
	print(ans)


t = int(input())
out = str()
for each in range(t):
	n = int(input())
	l = list(str(input()).split())
	l = [int(i) for i in l]
	c = 0
	j = 0
	for j in range(0, len(l)):
		if l[j] == 0:
			l[j] = 1
			c += 1
	if sum(l) == 0:
		c += 1
	out += str(c)
	if each < t:
		out += '\n'
print(out)


t = int(input())
for i in range(t):
	input()
	c = s = 0
	for j in list(map(int, input().strip().split())):
		if not j:
			c += 1
			j = 1
		s += j
	print(c + (0 if s else 1))


t = int(input())
for tc in range(0, t):
	n = int(input())
	a = [int(x) for x in input().split()]
	m = a.count(0)
	s = sum(a) + m
	if s != 0:
		print(m)
	elif all([x == -1 for x in a]):
		print(m + 2)
	else:
		print(m + 1)


t = int(input())
for i in range(t):
	z = 0
	s = 0
	res = 0
	n = int(input())
	l = list(map(int, input().split()))
	for j in range(len(l)):
		if l[j] == 0:
			z += 1
		s = s + l[j]
	if z == 0:
		if s == 0:
			print(1)
		else:
			print(0)
	else:
		res = z
		s = s + z
		if s == 0:
			print(res + 1)
		else:
			print(res)


test_cases = int(input())
for _ in range(test_cases):
	array_len = int(input())
	array = list(map(int, input().split()))
	min_steps = 0
	zeroes = 0
	for element in array:
		if element == 0:
			zeroes += 1
	min_steps += zeroes
	array_sum = sum(array) + zeroes
	if array_sum == 0:
		min_steps += 1
	print(min_steps)


for _ in range(int(input())):
	N = int(input())
	A = list(map(int, input().split(' ')))
	count = 0
	tot = 0
	for i in range(len(A)):
		if A[i] == 0:
			A[i] = 1
			count += 1
		tot += A[i]
	if tot != 0:
		print(count)
	else:
		print(count + 1)


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	ans = 0
	for i in range(N):
		if not A[i]:
			A[i] += 1
			ans += 1
	if sum(A) != 0:
		print(ans)
	else:
		flag = False
		for a in A:
			if a != -1:
				flag = True
		if flag:
			print(ans + 1)
		else:
			print(ans + 2)


n = int(input())
e = []
for i in range(n):
	q = int(input())
	l = list(map(int, input().split()))
	count = 0
	for j in range(len(l)):
		if l[j] == 0:
			l[j] += 1
			count += 1
	if sum(l) == 0:
		l[0] += 1
		count += 1
	e.append(count)
for k in range(len(e)):
	print(e[k])


t = int(input())
while t:
	n = int(input())
	l = list(map(int, input().split()))
	c = l.count(0)
	c1 = 0
	if c == 0:
		if sum(l) == 0:
			for i in range(len(l)):
				if l[i] > 0:
					c1 += 1
					break
			print(c1)
		else:
			print(0)
	elif sum(l) == 0:
		print(c)
	else:
		ans = c
		if ans + sum(l) == 0:
			print(c + 1)
		else:
			print(c)
	t = t - 1


t = int(input())
for i in range(t):
	n = int(input())
	ans = 0
	c = 0
	x = input()
	a = x.split()
	for j in range(n):
		if int(a[j]) == 0:
			c += 1
		ans += int(a[j])
	if ans + c == 0:
		print(c + 1)
	else:
		print(c)


T = int(input())
for i in range(T):
	n = int(input())
	A = list(map(int, input().split()))
	ind = []
	summ = 0
	for k in range(n):
		if A[k] == 0:
			ind.append(k)
		summ += A[k]
	if summ + len(ind) == 0:
		print(len(ind) + 1)
	else:
		print(len(ind))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ans = 0
	f = 0
	for i in range(n):
		if l[i] == 0:
			l[i] += 1
			ans += 1
	if sum(l) != 0:
		print(ans)
	else:
		print(ans + 1)


def solve():
	n = int(input())
	arr = [int(x) for x in input().split(' ')]
	ans = 0
	ans += arr.count(0)
	for (ind, i) in enumerate(arr):
		if i == 0:
			arr[ind] += 1
	if sum(arr) == 0:
		ans += 1
	return ans
t = int(input())
for i in range(t):
	ans = solve()
	print(ans)


from sys import stdin
inp = stdin.readline
t = int(inp())
for i in range(t):
	n = int(input())
	array = [int(x) for x in input().split()]
	needed = 0
	multiply = 1
	for l in array:
		multiply *= l
	if multiply != 0 and sum(array) != 0:
		print(needed)
		continue
	for j in range(n):
		if array[j] == 0:
			needed += 1
			array[j] += 1
	while True:
		if sum(array) == 0:
			array = sorted(array)
			for k in range(n):
				if array[k] != -1:
					array[k] += 1
					needed += 1
					break
		else:
			print(needed)
			break


mod = 1000000007
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	ans = 0
	for i in range(n):
		if a[i] == 0:
			a[i] += 1
			ans += 1
	if sum(a) == 0:
		ans += 1
	print(ans)


for _ in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().strip().split()]
	cnt = 0
	for i in range(n):
		if arr[i] == 0:
			cnt += 1
	sm = sum(arr) + cnt
	if sm == 0:
		cnt += 1
	print(cnt)


t = int(input())
for x in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	g = a.count(0)
	h = sum(a)
	ans = g
	h += g
	if h == 0:
		ans += 1
	print(ans)


import sys
import math

def read_line():
	return sys.stdin.readline()[:-1]

def read_int():
	return int(sys.stdin.readline())

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]
t = read_int()
for i in range(t):
	n = read_int()
	a = read_int_line()
	cnt = 0
	for i in range(n):
		if a[i] == 0:
			a[i] = 1
			cnt += 1
	if sum(a) == 0:
		cnt += 1
	print(cnt)


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	ans = a.count(0)
	summ = sum(a) + ans
	if summ == 0:
		print(ans + 1)
	else:
		print(ans)


t = int(input())
for q in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	sum = 0
	ans = 0
	d = 0
	flag = False
	for i in range(0, n):
		sum += a[i]
		if a[i] >= 0:
			flag = True
		if a[i] == 0:
			a[i] += 1
			sum += 1
			ans += 1
		if a[i] < 0:
			d += -1 - a[i]
	if sum == 0 and d != 0:
		print(ans + 1)
	if sum == 0 and d == 0 and (not flag):
		print(ans + 2)
	if sum == 0 and d == 0 and flag:
		print(ans + 1)
	if sum != 0:
		print(ans)


def gP(l, n):
	prod = 1
	for i in range(n):
		prod *= l[i]
	return prod

def mP(l, n):
	cnt = 0
	for i in range(n):
		if l[i] == 0:
			l[i] += 1
			cnt += 1
	return (l, cnt)

def mS(l, n):
	l[0] += 1
	return l

def result(l, n):
	cnt = 0
	s = sum(l)
	if s != 0 and gP(l, n) != 0:
		return cnt
	if gP(l, n) == 0:
		(l, tcnt) = mP(l, n)
		cnt += tcnt
	if sum(l) == 0:
		l = mS(l, n)
		cnt += 1
	return cnt
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	print(result(l, n))


t = int(input())
for _ in range(t):
	n = int(input())
	array = [int(x) for x in input().split()]
	no_of_zeroes = array.count(0)
	no_of_steps = no_of_zeroes
	positive_sum = negative_sum = 0
	positive_sum += no_of_zeroes
	for x in array:
		if x > 0:
			positive_sum += x
		elif x < 0:
			negative_sum += x
	if positive_sum == abs(negative_sum):
		no_of_steps += 1
	print(no_of_steps)


I = input
for _ in range(int(I())):
	k = 0
	n = int(I())
	a = I().split()
	s = 0
	for i in range(n):
		if a[i] == '0':
			k = k + 1
			a[i] = str(int(a[i]) + 1)
		s = s + int(a[i])
	if s == 0:
		k = k + 1
	print(k)


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	z = 0
	s = 0
	for i in a:
		s += i
		if i == 0:
			z += 1
	if z == 0 and s != 0:
		print(0)
	if z != 0:
		if s + z == 0:
			print(z + 1)
		else:
			print(z)
	elif s == 0:
		print(1)


a = int(input())
for i in range(a):
	n = int(input())
	c = list(map(int, input().split()))
	prod = 1
	for i in c:
		prod = prod * i
	total = sum(c)
	if total == 0:
		p = 0
		if prod != 0:
			for i in range(n):
				if c[i] > 0:
					c[i] = c[i] + 1
					p += 1
					print(p)
					break
		else:
			for i in range(n):
				if c[i] == 0:
					c[i] = c[i] + 1
					p += 1
			total = sum(c)
			if total == 0:
				for i in range(n):
					if c[i] > 0:
						c[i] = c[i] + 1
						p += 1
						print(p)
						break
			else:
				print(p)
	else:
		p = 0
		if prod == 0:
			for i in range(n):
				if c[i] == 0:
					c[i] = c[i] + 1
					p += 1
			total = sum(c)
			if total == 0:
				for i in range(n):
					if c[i] > 0:
						c[i] = c[i] + 1
						p += 1
						print(p)
						break
			else:
				print(p)
		else:
			print(p)


t = int(input())
cases = []
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	cases.append(a)
for c in cases:
	zer = c.count(0)
	s = sum(c)
	new_s = s + zer
	if new_s == 0:
		print(zer + 1)
	else:
		print(zer)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = sum(a)
	x = a.count(0)
	if s == 0:
		print(max(1, x))
	elif 0 - s == x:
		print(max(1, x) + 1)
	else:
		print(x)


for t in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split()]
	l.sort()
	z = 0
	y = 0
	for i in range(n):
		if l[i] == 0:
			z += 1
		elif l[i] < 0:
			y += 1
		else:
			break
	s = sum(l)
	if s + z != 0:
		print(z)
	else:
		print(z + 1)


from math import *
from sys import stdin, stdout
import itertools
import os
import sys
import threading
from collections import deque, Counter, OrderedDict, defaultdict
from heapq import *
from fractions import Fraction
mod = int(pow(10, 9) + 7)

def ii():
	return int(input())

def si():
	return str(input())

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

def li():
	return list(mi())

def fii():
	return int(stdin.readline())

def fsi():
	return str(stdin.readline())

def fmi():
	return map(int, stdin.readline().split())

def fli():
	return list(fmi())
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d:
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d:
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = defaultdict(list)
	for i in range(n):
		(x, y) = mi()
		d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(i)
			n = n // i
	if n > 2:
		s.add(n)
	return s

def find_all(a_str, sub):
	start = 0
	while True:
		start = a_str.find(sub, start)
		if start == -1:
			return
		yield start
		start += len(sub)

def SieveOfEratosthenes(n, isPrime):
	isPrime[0] = isPrime[1] = False
	for i in range(2, n):
		isPrime[i] = True
	p = 2
	while p * p <= n:
		if isPrime[p] == True:
			i = p * p
			while i <= n:
				isPrime[i] = False
				i += p
		p += 1
	return isPrime

def dijkstra(edges, f, t):
	g = defaultdict(list)
	for (l, r, c) in edges:
		g[l].append((c, r))
	(q, seen, mins) = ([(0, f, ())], set(), {f: 0})
	while q:
		(cost, v1, path) = heappop(q)
		if v1 not in seen:
			seen.add(v1)
			path = (v1, path)
			if v1 == t:
				return (cost, path)
			for (c, v2) in g.get(v1, ()):
				if v2 in seen:
					continue
				prev = mins.get(v2, None)
				next = cost + c
				if prev is None or next < prev:
					mins[v2] = next
					heappush(q, (next, v2, path))
	return float('inf')

def binsearch(a, l, r, x):
	while l <= r:
		mid = l + (r - 1) // 2
		if a[mid]:
			return mid
		elif a[mid] > x:
			l = mid - 1
		else:
			r = mid + 1
	return -1
t = ii()
for _ in range(t):
	z = 0
	n = ii()
	l = li()
	for i in range(n):
		if l[i] == 0:
			l[i] += 1
			z += 1
	s = sum(l)
	if s != 0:
		print(z)
	else:
		print(z + 1)


n = int(input())
while n:
	ispis = 0
	a = int(input())
	brojevi = list(map(int, input().split()))
	for i in range(len(brojevi)):
		if brojevi[i] == 0:
			brojevi[i] += 1
			ispis += 1
	if sum(brojevi) == 0:
		ispis += 1
	print(ispis)
	n -= 1


from sys import stdin, stdout
import bisect

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def soe(limit):
	l = [1] * (limit + 1)
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
			n = n - 1
		else:
			a = a * a
			n = n >> 1
	return r

def solve():
	n = inp()
	l = li()
	a = l.count(0)
	x = sum(l) + a
	if x == 0:
		a += 1
	pr(a)
for _ in range(inp()):
	solve()


def solve(a, n):
	cnt_zero = list(a).count(0)
	s = sum(a)
	ans = cnt_zero
	if s == cnt_zero * -1:
		return ans + 1
	else:
		return ans
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print(solve(a, n))


local = False
if local:
	file = open('A.txt', 'r')

def IN():
	if local:
		return file.readline()
	else:
		return input()

def solve(arr):
	ans = summed = 0
	for n in arr:
		if n == 0:
			ans += 1
			summed += 1
		else:
			summed += n
	if summed == 0:
		return ans + 1
	return ans
t = int(IN())
for i in range(t):
	count = int(IN())
	arr = [int(n) for n in IN().split()]
	print(solve(arr))


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	total = sum(arr)
	num_zero = 0
	for i in arr:
		if i == 0:
			num_zero += 1
	ans = num_zero
	total += ans
	if total == 0:
		ans += 1
	print(ans)


t = int(input())
for item in range(t):
	n = int(input())
	moves = 0
	sums = 0
	product = 1
	string = input()
	lists = string.split(' ')
	for m in range(n):
		lists[m] = int(lists[m])
	for x in range(n):
		if lists[x] == 0:
			lists[x] = 1
			moves += 1
		sums += lists[x]
	if sums == 0:
		moves += 1
	print(moves)


from sys import stdin, stdout
import traceback
read = stdin.readline
write = stdout.write
writeln = lambda x: write(str(x) + '\n')

def reads(typ=int):
	return list(map(typ, read().split()))

class Sol:

	@classmethod
	def input(cls):
		s = cls()
		return s

	def solve(self):
		ret = 0
		_ = read()
		an = reads()
		sum_a = sum(an)
		count_zero_a = sum([a == 0 for a in an])
		ret = count_zero_a
		sum_a += count_zero_a
		if sum_a == 0:
			ret += 1
		return ret
try:
	for _ in range(int(read())):
		writeln(Sol.input().solve())
except Exception as e:
	print('Got exception:', repr(e))
	print(traceback.format_exc())


from sys import stdin
input = stdin.readline
for xoxo in range(1):
	a = []
	for _ in range(int(input())):
		n = int(input())
		ans = 0
		a = list(map(int, input().split()))
		if a.count(0) == 0 and sum(a) != 0:
			print('0')
			continue
		elif a.count(0) > 0:
			for i in range(n):
				if a[i] == 0:
					a[i] += 1
					ans += 1
			s = sum(a)
			if s != 0:
				print(ans)
			else:
				print(1 - s + ans)
		else:
			print('1')


for _ in range(int(input())):
	n = int(input())
	count = 0
	ar = sorted(list(map(int, input().split())))
	for i in range(len(ar)):
		if ar[i] == 0:
			ar[i] += 1
			count += 1
	while sum(ar) == 0:
		ar[n - 1] += 1
		count += 1
	print(count)


a = int(input())
for i in range(a):
	b = int(input())
	x = [int(i) for i in input().split(' ')]
	(summ, product, steps) = (0, 0, 0)
	for i in range(len(x)):
		if x[i] == 0:
			x[i] += 1
			steps += 1
	for i in x:
		summ += i
	if summ == 0:
		steps += 1
	print(steps)


t = int(input())
while t:
	x = int(input())
	l = list(map(int, input().split()))
	p = 1
	c = 0
	s = 0
	for i in l:
		p = p * i
	if p == 0:
		for i in l:
			if i == 0:
				i = i + 1
				c = c + 1
			s = s + i
	else:
		for i in l:
			s = s + i
	if s == 0:
		l[0] = l[0] + 1
		c = c + 1
	print(c)
	t = t - 1


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	som = 0
	steps = 0
	for ai in a:
		if ai == 0:
			steps += 1
			som += 1
		else:
			som += ai
	if som == 0:
		print(steps + 1)
	else:
		print(steps)


q = int(input())
for e in range(q):
	l = int(input())
	arr = list(map(int, input().split()))
	res = 0
	summ = 0
	f = True
	for i in range(l):
		if arr[i] == 0:
			res += 1
		summ += arr[i]
	if summ + res == 0:
		res += 1
	print(res)


from bisect import bisect_left, bisect_right
from typing import List
import collections
import bisect
import itertools
import functools
from fractions import gcd
import heapq
from math import ceil, sqrt, floor
import sys
sys.setrecursionlimit(50000)
import collections
t = int(input())
for _ in range(t):
	n = int(input())
	As = list(map(int, input().split()))
	count = sum((1 if v == 0 else 0 for v in As))
	if sum(As) + count == 0:
		count += 1
	print(count)


for tc in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	if sum(l) == 0 and 0 in l:
		print(l.count(0))
	elif sum(l) == 0 and 0 not in l:
		print(1)
	elif sum(l) != 0 and 0 in l:
		if sum(l) + l.count(0) == 0:
			print(l.count(0) + 1)
		else:
			print(l.count(0))
	else:
		print(0)


t = int(input())
for _ in range(t):
	n = int(input())
	x = list(map(int, input().split()))
	zeroCount = 0
	totalSum = 0
	for c in x:
		if c == 0:
			zeroCount += 1
			c += 1
		totalSum += c
	if totalSum == 0:
		zeroCount += 1
	print(zeroCount)


import sys
import math
import bisect

def main():
	for _ in range(int(input())):
		n = int(input())
		A = list(map(int, input().split()))
		ans = 0
		for i in range(n):
			if A[i] == 0:
				A[i] = 1
				ans += 1
		if sum(A) == 0:
			if min(A) == max(A) == -1:
				ans += 2
			else:
				ans += 1
		print(ans)
main()


def prod(list):
	ans = 1
	for n in list:
		ans *= n
	return ans
for i in range(int(input())):
	a = input()
	nums = list(map(int, input().split()))
	if sum(nums) and prod(nums):
		print(0)
	elif sum(nums) + nums.count(0):
		print(nums.count(0))
	else:
		print(nums.count(0) + 1)


for i in range(int(input())):
	k = int(input())
	a = list(map(int, input().split()))
	b = sum(a)
	c = 1
	if 0 in a:
		c = 0
	(d, e, m) = (0, 0, 0)
	if c == 0:
		d = a.count(0)
		for i in range(d):
			e = a.index(0)
			a[e] += 1
			m += 1
		c = 1
	b = sum(a)
	if b == 0:
		a[0] += 1
		m += 1
	print(m)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ans = a.count(0)
	sa = sum(a) + ans
	if sa == 0:
		ans += 1
	print(ans)