#include <bits/stdc++.h>
long long T, n, a[500001];
signed main() {
  scanf("%lld", &T);
  for (long long fd = 1; fd <= T; fd++) {
    scanf("%lld", &n);
    std::set<long long> set;
    long long k = 1, b = 0;
    bool isall = 1;
    long long mn = 1;
    a[0] = 0x7f7f7f7f;
    long long L = -0x7f7f7f7f, R = 0x7f7f7f7f;
    for (long long i = 1; i <= n; i++) {
      scanf("%lld", a + i);
      k = -k, b = -b;
      b += a[i];
      std::swap(L, R);
      L = a[i] - L, R = a[i] - R;
      L = std::max(L, 1ll);
      R = std::min(R, a[i] - 1ll);
      if (L > R) isall = 0;
      if (a[i] % 2 == 0 && (set.count((a[i] >> 1) * k - b * k) ||
                            (isall && L <= (a[i] >> 1) && R >= (a[i] >> 1)))) {
        set.clear();
        set.insert((a[i] >> 1) * k - b * k);
        isall = 0;
      } else {
        if (a[i] % 2 == 0) set.insert((a[i] >> 1) * k - b * k);
        ++mn;
      }
      for (; set.size();) {
        if (((*set.begin()) * k + b) < 1 ||
            ((*set.begin()) * k + b) > a[i] - 1) {
          set.erase(*set.begin());
        } else if (((*set.rbegin()) * k + b) < 1 ||
                   ((*set.rbegin()) * k + b) > a[i] - 1) {
          set.erase(*set.rbegin());
        } else
          break;
      }
      if (set.empty() && !isall) {
        isall = 1, ++mn;
        L = 1, R = a[i] - 1;
      }
    }
    printf("%lld\n", mn);
  }
}
