#include <bits/stdc++.h>
using namespace std;
long long gi() {
  char cc = getchar();
  long long cn = 0, flus = 1;
  while (cc < '0' || cc > '9') {
    if (cc == '-') flus = -flus;
    cc = getchar();
  }
  while (cc >= '0' && cc <= '9') cn = cn * 10 + cc - '0', cc = getchar();
  return cn * flus;
}
const long long N = 5e5 + 5;
const long long inf = 1e9;
long long n, a[N], k, b, L, R;
set<long long> S;
set<long long>::iterator it;
bool find(long long x) {
  return (((L <= x) && (x <= R)) | (S.find(k * (x - b)) != S.end()));
}
long long st[N], top;
void Del(long long x) {
  top = 0;
  if (S.empty()) return;
  if (k == 1) {
    it = S.lower_bound(x - b);
    for (; it != S.end(); ++it) st[++top] = *it;
  } else {
    it = S.upper_bound(b - x);
    if (it == S.begin()) return;
    --it;
    for (; it != S.begin(); --it) st[++top] = *it;
    if (it == S.begin()) st[++top] = *it;
  }
  while (top) S.erase(st[top]), --top;
}
void solve() {
  n = gi();
  long long ans = 0;
  L = inf, R = 1, k = 1, b = 0;
  for (register long long i = (1); i <= (n); ++i) a[i] = gi();
  for (register long long i = (1); i <= (n); ++i) {
    if (a[i] % 2 == 0) {
      long long u = a[i] / 2;
      Del(a[i]);
      if (find(u))
        S.clear(), ans += 2, S.insert(k * (u - b)), L = inf, R = 1;
      else {
        ++ans, S.insert(k * (u - b));
        L = a[i] - L, R = a[i] - R, swap(L, R), L = max(L, 1ll);
        if (L > R) L = inf, R = 1;
      }
    } else {
      long long flag = 1;
      Del(a[i]), L = a[i] - L, R = a[i] - R, swap(L, R), L = max(L, 1ll);
      if (L > R) L = inf, R = 1, flag = 0;
      if (S.empty()) {
        if (flag)
          ++ans;
        else
          L = 1, R = a[i] - 1;
      } else
        ++ans;
    }
    k = -k, b = -b, b += a[i];
  }
  cout << 2 * n - ans << endl;
  S.clear();
}
signed main() {
  long long T = gi();
  while (T--) solve();
  return 0;
}
