#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int n;
    scanf("%d", &n);
    vector<int> A(n);
    for (int i = 0; i < n; ++i) {
      scanf("%d", &A[i]);
    }
    int ans = 1;
    set<pair<long long, long long>> S;
    long long delta = 0;
    int sgn = 1;
    if (A[0] & 1) {
      S = {{1, A[0] - 1}};
      ++ans;
    } else
      S = {{A[0] / 2, A[0] / 2}};
    for (int i = 1; i < n; ++i) {
      if (A[i] % 2 == 0) {
        long long half = A[i] >> 1;
        half = sgn * (half - delta);
        auto it = S.upper_bound({half, LLONG_MAX});
        if (it != S.begin() && prev(it)->second >= half) {
          S = {{half, half}};
        } else {
          S.insert({half, half});
          ++ans;
        }
      } else
        ++ans;
      long long mn = sgn * (1 - delta);
      long long mx = sgn * (A[i] - 1 - delta);
      if (mn > mx) swap(mn, mx);
      while (!S.empty()) {
        auto p = *S.begin();
        S.erase(S.begin());
        p.first = max(p.first, mn);
        if (p.first <= p.second) {
          S.insert(p);
          break;
        }
      }
      while (!S.empty()) {
        auto p = *prev(S.end());
        S.erase(prev(S.end()));
        p.second = min(p.second, mx);
        if (p.first <= p.second) {
          S.insert(p);
          break;
        }
      }
      if (S.empty()) {
        ++ans;
        delta = 0;
        sgn = 1;
        S.insert({1, A[i] - 1});
      } else {
        sgn = -sgn;
        delta = A[i] - delta;
      }
    }
    printf("%d\n", ans);
  }
}
