#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> a(n);
    int sum = 0;
    int prod = 1;
    int cnt0 = 0;
    int ans = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      prod = prod * a[i];
      if (a[i] == 0) cnt0++;
    }
    int j = 0;
    while (cnt0 != 0 && j < n) {
      if (a[j] == 0) {
        a[j]++;
        cnt0--;
        ans++;
      }
      j++;
    }
    for (int i = 0; i < n; i++) {
      sum = sum + a[i];
    }
    j = 0;
    while (sum == 0 && j < n) {
      if (a[j] > 0) {
        a[j]++;
        ans++;
        sum++;
      }
      j++;
    }
    cout << ans << endl;
  }
}
