#include <bits/stdc++.h>
int TC, N, a[500001], ans;
long long zero, dir;
std::set<std::pair<long long, long long> > S;
void clear() {
  zero = 0;
  dir = 1;
  S.clear();
}
void reverse(long long r) {
  zero = zero + r * dir;
  dir *= -1;
}
void add(long long l, long long r) {
  l = zero + l * dir;
  r = zero + r * dir;
  if (l > r) std::swap(l, r);
  S.insert({l, r});
}
void cut(long long l, long long r) {
  l = zero + l * dir;
  r = zero + r * dir;
  if (l > r) std::swap(l, r);
  auto il = S.lower_bound({l, -(1LL << 60)});
  if (il != S.begin()) {
    auto jl = il;
    std::pair<long long, long long> edge = *--jl;
    S.erase(S.begin(), il);
    if (edge.second >= l) S.insert({l, edge.second});
  }
  S.erase(S.lower_bound({r + 1, -(1LL << 60)}), S.end());
  if (!S.empty()) {
    auto jr = S.end();
    jr--;
    if (jr->second > r) {
      std::pair<long long, long long> edge = {jr->first, r};
      S.erase(jr);
      S.insert(edge);
    }
  }
}
bool check(long long x) {
  x = zero + x * dir;
  auto i = S.lower_bound({x + 1, -(1LL << 60)});
  if (i == S.begin()) return false;
  i--;
  return i->second >= x;
}
bool empty() { return S.empty(); }
int main() {
  for (scanf("%d", &TC); TC--;) {
    scanf("%d", &N);
    for (int i = 1; i <= N; i++) {
      scanf("%d", a + i);
      a[i] -= 2;
    }
    clear();
    if (a[1] % 2 == 0) {
      ans = 1;
      add(a[1] / 2, a[1] / 2);
    } else {
      ans = 2;
      add(0, a[1]);
    }
    for (int i = 2; i <= N; i++) {
      cut(0, a[i]);
      reverse(a[i]);
      if (empty()) {
        add(0, a[i]);
        ans++;
      }
      if (a[i] % 2 == 0) {
        if (check(a[i] / 2))
          cut(a[i] / 2, a[i] / 2);
        else {
          add(a[i] / 2, a[i] / 2);
          ans++;
        }
      } else
        ans++;
    }
    printf("%d\n", ans);
  }
  return 0;
}
