One day, BThero decided to play around with arrays and came up with the following problem:

You are given an array a, which consists of n positive integers. The array is numerated 1 through n. You execute the following procedure exactly once:

  * You create a new array b which consists of 2n positive integers, where for each 1 ≤ i ≤ n the condition b_{2i-1}+b_{2i} = a_i holds. For example, for the array a = [6, 8, 2] you can create b = [2, 4, 4, 4, 1, 1]. 
  * You merge consecutive equal numbers in b. For example, b = [2, 4, 4, 4, 1, 1] becomes b = [2, 4, 1]. 



Find and print the minimum possible value of |b| (size of b) which can be achieved at the end of the procedure. It can be shown that under the given constraints there is at least one way to construct b.

Input

The first line of the input file contains a single integer T (1 ≤ T ≤ 5 ⋅ 10^5) denoting the number of test cases. The description of T test cases follows.

The first line of each test contains a single integer n (1 ≤ n ≤ 5 ⋅ 10^5).

The second line contains n space-separated integers a_1, a_2, ..., a_n (2 ≤ a_i ≤ 10^9).

It is guaranteed that ∑{n} over all test cases does not exceed 5 ⋅ 10^5.

Output

For each test case, print a single line containing one integer — the minimum possible value of |b|.

Example

Input


3
3
6 8 2
1
4
3
5 6 6


Output


3
1
2
#include <bits/stdc++.h>
using namespace std;
inline int rin(int &r) {
  int b = 1, c = getchar();
  r = 0;
  while (c < '0' || '9' < c) b = c == '-' ? -1 : b, c = getchar();
  while ('0' <= c && c <= '9') r = (r * 10) + (c ^ '0'), c = getchar();
  return r *= b;
}
const int N = 5e5 + 10;
int ncas, n, lseg, rseg;
int num[N];
set<long long> sig;
int solve() {
  int mxval = 0;
  long long vark = 1, varb = 0;
  sig.clear();
  if (num[1] & 1) {
    lseg = 1, rseg = num[1] - 1;
    mxval = 0;
  } else {
    lseg = 1, rseg = 0;
    sig.insert(num[1] >> 1);
    mxval = 1;
  }
  for (int i = 2; i <= n; i++) {
    if (lseg <= rseg) {
      if (lseg >= num[i])
        lseg = 1, rseg = 0;
      else
        rseg = min(rseg, num[i] - 1);
    }
    if (vark == 1) {
      while (!sig.empty() && *sig.begin() < 1 - varb) sig.erase(sig.begin());
      while (!sig.empty() && *sig.rbegin() >= num[i] - varb)
        sig.erase(*sig.rbegin());
    } else {
      while (!sig.empty() && *sig.begin() <= varb - num[i])
        sig.erase(sig.begin());
      while (!sig.empty() && *sig.rbegin() > varb - 1) sig.erase(*sig.rbegin());
    }
    if (num[i] & 1)
      if (lseg > rseg && sig.empty()) {
        lseg = 1, rseg = num[i] - 1;
      } else {
        if (lseg <= rseg) {
          swap(lseg, rseg);
          lseg = num[i] - lseg;
          rseg = num[i] - rseg;
        }
        vark = -vark, varb = num[i] - varb;
        mxval++;
      }
    else if (lseg > rseg && sig.empty()) {
      lseg = 1, rseg = 0;
      sig.insert((((num[i] >> 1) - varb) / vark));
      mxval++;
    } else {
      vark = -vark, varb = num[i] - varb;
      if (lseg <= rseg) {
        swap(lseg, rseg);
        lseg = num[i] - lseg;
        rseg = num[i] - rseg;
      }
      int x = num[i] >> 1;
      if ((lseg <= x && x <= rseg) || sig.count((((x)-varb) / vark))) {
        lseg = 1, rseg = 0;
        sig.clear();
        sig.insert((((x)-varb) / vark));
        mxval += 2;
      } else {
        sig.insert((((x)-varb) / vark));
        mxval++;
      }
    }
  }
  return (n << 1) - mxval;
}
int main() {
  rin(ncas);
  while (ncas--) {
    rin(n);
    for (int i = 1; i <= n; i++) rin(num[i]);
    printf("%d\n", solve());
  }
  return 0;
}
