#include <algorithm>
#include <cmath>
#include <vector>
#include <iostream>
using namespace std;

void solve() {
    int n, totalCost, prev, x, cost;
    totalCost = 0;
    cin >> n;

    if (n <= 1) {
        cout << 0 << "\n";
        return;
    }

    cin >> prev;

    int m, M;

    for (int i = 1; i < n; ++i) {
        cin >> x;

        if (x < prev) {
            m = x;
            M = prev;
        } else {
            m = prev;
            M = x;
        }

        if (m * 2 < M) {
            cost = int(ceil(log2(float(M) / float(m)))) - 1;
           // cout << "->" << m << " " << M << " " << cost << "\n";
            totalCost += cost;
        }

        prev = x;
    }

    cout << totalCost << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T;
    cin >> T;

    for (int t = 0; t < T; ++t) {
        solve();
    }

    return 0;
}