#include <bits/stdc++.h>
using namespace std;
set<pair<long long, long long> > S;
set<pair<long long, long long> >::iterator it;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t, n;
  for (cin >> t; t--;) {
    cin >> n;
    S.clear();
    long long a = 1, b = 0, ans = 0, u;
    for (int i = 0; i < n; i++) {
      cin >> u;
      long long s = a * (1 - b), e = a * (u - 1 - b);
      if (a < 0) swap(s, e);
      while (!S.empty()) {
        pair<long long, long long> v = *S.begin();
        if (v.first >= s)
          break;
        else {
          S.erase(S.begin());
          if (v.second >= s) S.insert(pair<long long, long long>(s, v.second));
        }
      }
      while (!S.empty()) {
        it = S.end();
        it--;
        pair<long long, long long> v = *it;
        if (v.second > e)
          S.erase(it);
        else
          break;
        if (v.first <= e) S.insert(pair<long long, long long>(v.first, e));
      }
      if (S.empty()) {
        if (a > 0)
          S.insert(pair<long long, long long>(a * (1 - b), a * (u - b)));
        else
          S.insert(pair<long long, long long>(a * (u - b), a * (1 - b)));
      } else
        ans++;
      a *= -1, b = u - b;
      if (u % 2 == 0) {
        it = S.upper_bound(
            pair<long long, long long>(a * (u / 2 - b), 1000000000000000000ll));
        if (it == S.begin())
          S.insert(
              pair<long long, long long>(a * (u / 2 - b), a * (u / 2 - b)));
        else {
          it--;
          pair<long long, long long> v = *it;
          if (v.first <= a * (u / 2 - b) && v.second >= a * (u / 2 - b)) {
            S.clear();
            a = 1;
            b = 0;
            ans++;
          }
          S.insert(
              pair<long long, long long>(a * (u / 2 - b), a * (u / 2 - b)));
        }
      }
    }
    cout << n * 2 - ans << endl;
  }
  return 0;
}
