#include <bits/stdc++.h>
using namespace std;
int gi() {
  int res = 0, w = 1;
  char ch = getchar();
  while (ch != '-' && !isdigit(ch)) ch = getchar();
  if (ch == '-') w = -1, ch = getchar();
  while (isdigit(ch)) res = res * 10 + ch - '0', ch = getchar();
  return res * w;
}
const int MAX_N = 5e5 + 5;
int N, a[MAX_N];
long long zero, two;
set<pair<long long, long long> > one;
void solve() {
  N = gi(), one.clear(), zero = 0, two = -1;
  for (int i = 1; i <= N; i++) a[i] = gi();
  long long op = 1, shift = 0;
  for (int i = 1; i <= N; i++) {
    if (two != -1) {
      zero = zero + 2, one.clear(), op = 1, shift = 0;
      if (a[i] - two > 0) one.insert(make_pair(a[i] - two, a[i] - two));
    } else if (one.size()) {
      if (op == 1) {
        while (one.size() && one.rbegin()->first + shift >= a[i])
          one.erase(*one.rbegin());
        if (one.size() && one.rbegin()->second + shift >= a[i]) {
          int t = one.rbegin()->first;
          one.erase(*one.rbegin()), one.insert(make_pair(t, a[i] - shift - 1));
        }
      } else {
        while (one.size() && -one.begin()->second + shift >= a[i])
          one.erase(one.begin());
        if (one.size() && -one.begin()->first + shift >= a[i]) {
          int t = one.begin()->second;
          one.erase(one.begin()), one.insert(make_pair(shift - a[i] + 1, t));
        }
      }
      zero = zero + 1, op = -op, shift = a[i] - shift;
    } else {
      op = -1, shift = a[i];
      if (i != 1) one.insert(make_pair(1, min(a[i - 1], a[i]) - 1));
    }
    two = -1;
    if (a[i] & 1) continue;
    long long p = op * (a[i] / 2 - shift);
    auto it = one.lower_bound(make_pair(p + 1, p + 1));
    if (it != one.begin()) {
      --it;
      if (it->first <= p && p <= it->second) {
        if (it->first != p) one.insert(make_pair(it->first, p - 1));
        if (it->second != p) one.insert(make_pair(p + 1, it->second));
        one.erase(it), two = a[i] / 2;
      } else
        one.insert(make_pair(p, p));
    } else
      one.insert(make_pair(p, p));
  }
  int ans = 2 * N - ((~two) ? (zero + 2) : (one.size() ? (zero + 1) : zero));
  printf("%d\n", ans);
}
int main() {
  int T = gi();
  while (T--) solve();
  return 0;
}
