#include <bits/stdc++.h>
using namespace std;
int s, p = 1;
int sum1(int a[], int n) {
  s = 0;
  for (int i = 0; i < n; i++) s = s + a[i];
  return s;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, c = 0, sum;
    cin >> n;
    int a[n], q[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) q[i] = a[i];
    sum = sum1(a, n);
    if (sum == 0) {
      a[0] = a[0] + 1;
      c++;
      sum1(a, n);
    }
    int e = 0;
    int w = sum1(q, n);
    for (int i = 0; i < n; i++)
      if (q[i] == 0) e = e + 1;
    int y = e + w;
    if (y == 0) e++;
    if (c > e)
      cout << c << endl;
    else
      cout << e << endl;
  }
  return 0;
}
