#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
void test_case() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  const int INF = 1e9 + 5;
  long long L = 1, R = INF;
  set<long long> s;
  long long offset = 0;
  int dp = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    if (i % 2 == 1) {
      int diff = a[i] - a[i - 1];
      L += diff;
      R += diff;
      offset += diff;
    }
    L = max(L, 1LL);
    R = min(R, a[i] - 1LL);
    while (!s.empty() && *s.begin() + offset < 1) {
      s.erase(s.begin());
    }
    while (!s.empty() && *s.rbegin() + offset >= a[i]) {
      s.erase(prev(s.end()));
    }
    if (L <= R || !s.empty()) {
      if (i != 0) {
        dp++;
      }
      if (a[i] % 2 == 0) {
        if ((L <= a[i] / 2 && a[i] / 2 <= R) || s.count(a[i] / 2 - offset)) {
          dp++;
          L = R = a[i] / 2;
          s.clear();
        } else {
          s.insert(a[i] / 2 - offset);
        }
      }
    } else {
      L = 1;
      R = a[i] - 1;
      if (a[i] % 2 == 0) {
        L = R = a[i] / 2;
        dp++;
      }
    }
  }
  debug() << " ["
          << "dp"
             ": "
          << (dp) << "] ";
  printf("%d\n", 2 * n - dp);
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    test_case();
  }
}
