Polycarp calls an array dense if the greater of any two adjacent elements is not more than twice bigger than the smaller. More formally, for any i (1 ≤ i ≤ n-1), this condition must be satisfied: $$$(max(a[i], a[i+1]))/(min(a[i], a[i+1])) ≤ 2$$$

For example, the arrays [1, 2, 3, 4, 3], [1, 1, 1] and [5, 10] are dense. And the arrays [5, 11], [1, 4, 2], [6, 6, 1] are not dense.

You are given an array a of n integers. What is the minimum number of numbers you need to add to an array to make it dense? You can insert numbers anywhere in the array. If the array is already dense, no numbers need to be added.

For example, if a=[4,2,10,1], then the answer is 5, and the array itself after inserting elements into it may look like this: a=[4,2,\underline{3},\underline{5},10,\underline{6},\underline{4},\underline{2},1] (there are other ways to build such a).

Input

The first line contains one integer t (1 ≤ t ≤ 1000). Then t test cases follow.

The first line of each test case contains one integer n (2 ≤ n ≤ 50) — the length of the array a.

The next line contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 50).

Output

For each test case, output one integer — the minimum number of numbers that must be added to the array to make it dense.

Example

Input


6
4
4 2 10 1
2
1 3
2
6 1
3
1 4 2
5
1 2 3 4 3
12
4 31 25 50 30 20 34 46 42 16 15 16


Output


5
1
2
1
0
3

Note

The first test case is explained in the statements.

In the second test case, you can insert one element, a=[1,\underline{2},3].

In the third test case, you can insert two elements, a=[6,\underline{4},\underline{2},1].

In the fourth test case, you can insert one element, a=[1,\underline{2},4,2].

In the fifth test case, the array a is already dense.
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
// using namespace std;

#define ff              first
#define ss              second
#define ll             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rep(i,a,b)          for(ll i = a; i < b; ++i)
void c_p_c()
{
#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output2.txt", "w", stdout);
#endif
}
ll flag[1000000] = {0};
void seive()
{
	// ll flag[1000000]={0};
	for (ll i = 2; i < 100000; i++)
	{
		if (flag[i] == 0)
		{
			for (ll j = i * i; j < 1000000; j = j + i)
			{
				flag[j] = 1;

			}
		}
	}
	flag[1] = 1;
	flag[0] = 1;
}
bool check_perfect_square(ll n) {
	double sqrt_n = sqrt(n);
	if (sqrt_n == int(sqrt_n)) {
		return true;
	}
	else {
		return false;
	}
}
// }
// ll solve(ll a, ll b)
// {

// 	if (a == 0)
// 	{
// 		return 0;
// 	}
// 	if (b == 1)
// 	{
// 		ll s = solve(a, b + 1);
// 		return s;
// 	}
// 	else {
// 		ll op1 = solve(a / 2, b);
// 		ll op2 = solve(a, b + 1);
// 		return min(op1, op2);
// 	}

// }

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	c_p_c();
	w(t)
	{
		ll n, arr[100000];
		cin >> n;
		rep(i, 0, n)
		{
			cin >> arr[i];
		}
		ll c = 0;
		rep(i, 0, n - 1)
		{
			ll m1 = max(arr[i], arr[i + 1]);
			ll m2 = min(arr[i], arr[i + 1]);
			while (m2 * 2 < m1)
			{
				c++;
				m2 = m2 * 2;
			}
		}
		cout << c << endl;
	}
}

