#include <bits/stdc++.h>
using namespace std;
#include <string>
typedef long long ll;
//-Wfatal-errors
// node=vertex . edges connect vertices
// alias d++='g++ -std=c++17 -Wshadow -Wall -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG -g '
// const double PI=acos(-1.0);
// cout << setprecision(20) << x << endl;

struct s_ix {
    ll t, ix, b;
};
bool operator<(s_ix aa, s_ix bb) {
    if (aa.t == bb.t) return aa.b > bb.b;
    return aa.t < bb.t;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll T;
    // next_permutation
    // set<ll> pos;
    // if(pos.count()>0){
    //  pos.insert(a);}

    // T=1;
    cin>>T;

    // for (int j=0;j<n;j++)a[j]=0;
    while(T--){
        int tot,n,a[100];
        cin >> n;
        tot=0;
        for (int j=0;j<n;j++)cin>>a[j];
        for (int j=1;j<n;j++){
            int x=a[j-1];
            while(x<(a[j]+1)/2){
                tot++;
                x*=2;
            }
            x=a[j-1];
            while(x>a[j]*2){
                tot++;
                x=(x+1)/2;
            }
        }
        cout<<tot<<endl;
    }
}
