#include <bits/stdc++.h>
using namespace std;
int A[500005];
int n;
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &A[i]);
    int s0 = 0, s2 = -1;
    set<pair<long long, long long> > S;
    long long now = 0;
    int flg = 1;
    for (int i = 1; i <= n; i++) {
      int x = A[i];
      if (s2 != -1) {
        s0 += 2;
        flg = 1, now = 0;
        S.clear();
        if (s2 < x) S.insert(make_pair(x - s2, x - s2));
      } else if (!S.empty()) {
        s0++;
        if (flg == -1) {
          long long lim = now - x;
          while (!S.empty() && S.begin()->second <= lim) S.erase(S.begin());
          if (!S.empty() && S.begin()->first <= lim) {
            pair<long long, long long> it =
                make_pair(lim + 1, S.begin()->second);
            S.erase(S.begin());
            S.insert(it);
          }
        } else {
          long long lim = x - now;
          while (!S.empty() && S.rbegin()->first >= lim) S.erase(--S.end());
          if (!S.empty() && S.rbegin()->second >= lim) {
            pair<long long, long long> it =
                make_pair(S.rbegin()->first, lim - 1);
            S.erase(--S.end());
            S.insert(it);
          }
        }
        now = x - now;
        flg *= -1;
      } else {
        flg = -1;
        now = x;
        int lim = min(A[i - 1] - 1, x - 1);
        if (1 <= lim) S.insert(make_pair(1, lim));
      }
      s2 = -1;
      if (x % 2 == 0) {
        int y = x / 2;
        long long val = (y - now) / flg;
        set<pair<long long, long long> >::iterator it =
            S.lower_bound(make_pair(val + 1, (long long)-1e18));
        bool sig = 0;
        if (it != S.begin()) {
          --it;
          if (it->first <= val && val <= it->second) sig = 1;
        }
        if (sig)
          s2 = y;
        else
          S.insert(make_pair(val, val));
      }
    }
    int ans;
    if (s2 != -1)
      ans = s0 + 2;
    else if (!S.empty())
      ans = s0 + 1;
    else
      ans = s0;
    printf("%d\n", 2 * n - ans);
  }
}
