#include <bits/stdc++.h>
using namespace std;
const int N = 500005;
int n, A;
int mx, l, r;
long long K, B;
set<long long> p;
void cl() {
  r = min(r, A - 1);
  if (l > r) l = r = 0;
  if (K > 0) {
    long long qx = A - B;
    while (!p.empty()) {
      set<long long>::iterator ga = p.lower_bound(qx);
      if (ga != p.end())
        p.erase(ga);
      else
        break;
    }
  } else {
    long long qx = B - A;
    while (!p.empty()) {
      set<long long>::iterator la = p.upper_bound(qx);
      if (la != p.begin())
        la--, p.erase(la);
      else
        break;
    }
  }
}
void rev() {
  if (l) l = A - l, r = A - r, swap(l, r);
  K = -K;
  B = A - B;
}
int chkmax(int x) {
  if (x >= l && x <= r) return 1;
  set<long long>::iterator nxt = p.lower_bound((x - B) * K);
  return nxt != p.end() && *nxt == (x - B) * K;
}
void solve() {
  mx = -1;
  l = 1;
  r = 1e9;
  K = 1;
  B = 0;
  p.clear();
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &A);
    cl();
    rev();
    if (l || !p.empty())
      mx++;
    else
      l = 1, r = A - 1;
    if (A & 1) continue;
    if (chkmax(A / 2)) mx++, l = r = 0, p.clear();
    p.insert((A / 2 - B) * K);
  }
  printf("%d\n", 2 * n - mx);
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) solve();
  return 0;
}
