#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int l;
#define fastIO              ios::sync_with_stdio(false), cin.tie(0)
#define pf                  push_front
#define pb                  push_back
#define popb                pop_back()
#define popf                pop_front()
#define loop(i,n)           for(int i=0;i<n;i++)
#define loope(i,n)           for(int i=0;i<=n;i++)
#define loop1(i,n)           for(int i=1;i<n;i++)
#define loops(i,x,n)        for(int i=x;i<n;i++)
#define loopr(i,n)          for(int i=n-1;i>=0;i--)
#define loop1e(i,n)          for(int i=1;i<=n;i++)
#define F first
#define S second
#define LB lower_bound
#define UB upper_bound
#define vc vector
#define vll vector<long long>
#define pll pair<long long,long long>
#define eb emplace_back
#define pb push_back
//#define mp make_pair
#define INT_BITS 32
#define  st                  l t; cin>>t;
#define  sn                  l n; cin>>n;
#define all(x) x.begin(),x.end()
//#define  unordered_map<l,l>  u;
#define MOD1 1000000007
l solve(l a,l b)
{
	l cnt=0;
	while(a<b)
	{
		a=a*2;
		cnt++;
	}
	cnt--;
	return cnt;
}
int main()
{
  #ifndef ONLINE_JUDGE
    //for getting input from input.txt
    freopen("input.txt","r",stdin);
    //for writing output to output.txt
    freopen("output1.txt","w",stdout);
    #endif
    fastIO;
    l t;
    cin>>t;
    while(t--)
    {
    	l n;
    	cin>>n;
    	l a[n];
    	loop(i,n)
    	cin>>a[i];
    	l ans=0;
    	for(l i=0;i<n-1;i++)
    	{
    		l mx = max(a[i],a[i+1]);
    		l mi = min(a[i],a[i+1]);
    		double d = ceil(double(mx)/mi);
    		if(d<=2)
    			continue;
    		else
    		{
    			ans+=solve(mi,mx);

    		}

    	}
    	cout<<ans<<endl;

    }
 
    return 0;
}

### Prompt

Develop a solution in CPP to the problem described below:

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.

### Response

```cpp
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int l;
#define fastIO              ios::sync_with_stdio(false), cin.tie(0)
#define pf                  push_front
#define pb                  push_back
#define popb                pop_back()
#define popf                pop_front()
#define loop(i,n)           for(int i=0;i<n;i++)
#define loope(i,n)           for(int i=0;i<=n;i++)
#define loop1(i,n)           for(int i=1;i<n;i++)
#define loops(i,x,n)        for(int i=x;i<n;i++)
#define loopr(i,n)          for(int i=n-1;i>=0;i--)
#define loop1e(i,n)          for(int i=1;i<=n;i++)
#define F first
#define S second
#define LB lower_bound
#define UB upper_bound
#define vc vector
#define vll vector<long long>
#define pll pair<long long,long long>
#define eb emplace_back
#define pb push_back
//#define mp make_pair
#define INT_BITS 32
#define  st                  l t; cin>>t;
#define  sn                  l n; cin>>n;
#define all(x) x.begin(),x.end()
//#define  unordered_map<l,l>  u;
#define MOD1 1000000007
l solve(l a,l b)
{
	l cnt=0;
	while(a<b)
	{
		a=a*2;
		cnt++;
	}
	cnt--;
	return cnt;
}
int main()
{
  #ifndef ONLINE_JUDGE
    //for getting input from input.txt
    freopen("input.txt","r",stdin);
    //for writing output to output.txt
    freopen("output1.txt","w",stdout);
    #endif
    fastIO;
    l t;
    cin>>t;
    while(t--)
    {
    	l n;
    	cin>>n;
    	l a[n];
    	loop(i,n)
    	cin>>a[i];
    	l ans=0;
    	for(l i=0;i<n-1;i++)
    	{
    		l mx = max(a[i],a[i+1]);
    		l mi = min(a[i],a[i+1]);
    		double d = ceil(double(mx)/mi);
    		if(d<=2)
    			continue;
    		else
    		{
    			ans+=solve(mi,mx);

    		}

    	}
    	cout<<ans<<endl;

    }
 
    return 0;
}

```