#include <bits/stdc++.h>
using namespace std;
long long max(long long a, long long b) { return (a > b ? a : b); }
int t;
int n, a[600001];
int h;
long long l, r;
int sign;
long long offset;
set<long long> S;
bool isIn(long long u) {
  if (l != -1 && l <= u && u <= r) return true;
  long long v = (u - offset) * sign;
  return (S.find(v) != S.end());
}
void cc() {
  offset = 0;
  sign = 1;
  S.clear();
}
void clr() {
  while (S.size()) {
    if (sign == 1) {
      auto f = *(S.begin());
      long long eff = (f * sign + offset);
      if (eff < 0) {
        S.erase(S.begin());
      } else {
        return;
      }
    } else {
      auto f = S.end();
      --f;
      long long eff = ((*f) * sign + offset);
      if (eff < 0) {
        S.erase(f);
      } else {
        return;
      }
    }
  }
}
void solve() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) a[i] -= 2;
  cc();
  h = 0;
  l = 0;
  r = (long long)20000000000;
  for (int i = 1; i <= n; i++) {
    if (a[i] % 2 != 0) {
      sign *= -1;
      offset = a[i] - offset;
      clr();
      int isRange = (l != -1 && a[i] >= l);
      int hasPoint = (S.size() > 0);
      if (!isRange) {
        l = r = -1;
      } else {
        long long nl = max(0, a[i] - r);
        long long nr = max(0, a[i] - l);
        l = nl;
        r = nr;
      }
      if (!isRange && !hasPoint) {
        cc();
        l = 0;
        r = a[i];
      } else
        h++;
    } else {
      if (isIn(a[i] / 2)) {
        cc();
        S.insert(a[i] / 2);
        l = r = -1;
        h += 2;
      } else {
        sign *= -1;
        offset = a[i] - offset;
        clr();
        int isRange = (l != -1 && a[i] >= l);
        int hasPoint = (S.size() > 0);
        if (!isRange) {
          l = r = -1;
        } else {
          long long nl = max(0, a[i] - r);
          long long nr = max(0, a[i] - l);
          l = nl;
          r = nr;
        }
        S.insert((a[i] / 2 - offset) * sign);
        h++;
      }
    }
  }
  printf("%d\n", 2 * n - h + 1);
}
int main() {
  scanf("%d", &t);
  while (t--) solve();
}
