#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << '{';
  string sep;
  for (const auto &x : v) os << sep << x, sep = ", ";
  return os << '}';
}
template <typename T, size_t size>
ostream &operator<<(ostream &os, const array<T, size> &arr) {
  os << '{';
  string sep;
  for (const auto &x : arr) os << sep << x, sep = ", ";
  return os << '}';
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &p) {
  return os << '(' << p.first << ", " << p.second << ')';
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &v) {
  os << '{';
  string sep;
  for (const auto &x : v) os << sep << x, sep = ", ";
  return os << '}';
}
void dbg_out() { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cerr << ' ' << H;
  dbg_out(T...);
}
const int64_t INF64 = int64_t(2e18) + 5;
void run_case() {
  int N;
  cin >> N;
  vector<int64_t> A(N);
  for (auto &a : A) cin >> a;
  int64_t b_low = -INF64, b_high = -INF64;
  set<int64_t> points;
  int64_t sign = 1, offset = 0;
  int answer;
  if (A[0] % 2 == 0) {
    points.insert(A[0] / 2);
    answer = 1;
  } else {
    b_low = 1;
    b_high = A[0] - 1;
    answer = 2;
  }
  auto transform = [&](int64_t x) { return (x - offset) * sign; };
  auto contains = [&](int64_t x) {
    if (b_low <= x && x <= b_high) return true;
    return points.find(transform(x)) != points.end();
  };
  auto insert = [&](int64_t x) {
    x = transform(x);
    points.insert(x);
  };
  auto clear = [&] {
    b_low = b_high = -INF64;
    points.clear();
    sign = 1;
    offset = 0;
  };
  auto overlaps_segment = [&](int64_t low, int64_t high) {
    if (max(low, b_low) <= min(high, b_high)) return true;
    low = transform(low);
    high = transform(high);
    if (low > high) swap(low, high);
    auto it = points.lower_bound(low);
    return it != points.end() && *it <= high;
  };
  for (int i = 1; i < N; i++) {
    int64_t half = -1;
    if (A[i] % 2 == 0) {
      half = A[i] / 2;
      if (contains(half)) {
        clear();
        insert(half);
        continue;
      }
    }
    if (half >= 0 || overlaps_segment(1, A[i] - 1)) {
      if (sign > 0) {
        while (!points.empty() && *points.rbegin() * sign + offset > A[i] - 1)
          points.erase(prev(points.end()));
      } else {
        while (!points.empty() && *points.begin() * sign + offset > A[i] - 1)
          points.erase(points.begin());
      }
      if (b_high >= 0) {
        b_high = min(b_high, A[i] - 1);
        b_low = A[i] - b_low;
        b_high = A[i] - b_high;
        swap(b_low, b_high);
      }
      sign *= -1;
      offset = A[i] - offset;
      if (half >= 0) insert(half);
      answer++;
    } else {
      clear();
      b_low = 1;
      b_high = A[i] - 1;
      answer += 2;
    }
  }
  cout << answer << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int tests;
  cin >> tests;
  while (tests-- > 0) run_case();
}
