#include<bits/stdc++.h>

using namespace std;

vector<long long>v;

long long bala(vector<long long>v4,long long p)
{
    long long s,z=0,lol;
    vector<long long>v3;

    for(long long x=0; x<p-1; x++)
    {
        if(v4[x]>v4[x+1])
        {
            s=v4[x]-v4[x+1];
            v3.push_back(s);
            v4[x+1]=v4[x+1]+s;

        }

    }

    lol=v3.size();
    sort(v3.begin(),v3.end());
    if(lol==0)
    {
        return 0;
    }
    else
    {
        return v3[lol-1];
    }

  for(int i=0;i<p;i++)
  {
      cout<<v4[i]<<endl;
  }

}

long long a,b=0,c,d,e,i;

int main()
{
    cin>>a;
    while(b<a)
    {
        cin>>c;
        v.clear();
        for(i=0; i<c; i++)
        {
            cin>>d;
            v.push_back(d);
        }
        e=bala(v,c);
        if(e==0)
        {
            cout<<'0'<<endl;
        }
        if((floor(log2(e))==ceil(log2(e))) && (e!=0))
        {
             cout<<log2(e)+1<<endl;
        }
        else if((floor(log2(e))!=ceil(log2(e))) && (e!=0))
        {
            cout<<ceil(log2(e))<<endl;
        }
        b++;

    }

}


#include<bits/stdc++.h>

using namespace std;

vector<long long>v;
vector<long long>::iterator vit;

vector<long long>v1;
vector<long long>::iterator v1it;

long long a,b=0,c,d,e,f,g,h,i,j,max_index,max_value;

int main()
{
    cin>>a;
    while(b<a)
    {
        cin>>c;
        v.clear();
        v1.clear();
        f=0;
        for(i=0;i<c;i++)
        {
            cin>>d;
            v.push_back(d);
            v1.push_back(d);

        }
        max_index=max_element(v.begin(),v.end())-v.begin();
        max_value=*max_element(v.begin(),v.end());

        sort(v1.begin()+max_index,v1.end());
        f=v1[c-1]-v1[max_index];

        if(f==0)
        {
            cout<<f<<endl;
        }
        if((ceil(log2(f))==floor(log2(f))) && f!=0)
        {
            cout<<(log2(f)+1)<<endl;
        }
        else if((ceil(log2(f)))!=floor(log2(f)) && f!=0)
        {
            cout<<ceil(log2(f))<<endl;
        }

        b++;
    }
}


#include<bits/stdc++.h>

using namespace std;

vector<long long>v;
vector<long long>::iterator vit;

vector<long long>v1;
vector<long long>::iterator v1it;

vector<long long>v2;
vector<long long>::iterator v2it;

long long bala(vector<long long>v4,vector<long long>v5,long long p)
{
    long long array1[p+1];
    for(long long x=0; x<p; x++)
    {
       array1[x]=v4[x]-v5[x];
    }
    sort(array1,array1+p) ;
    return array1[p-1];

}

long long a,b=0,c,d,e,i;

int main()
{
    cin>>a;
    while(b<a)
    {
        cin>>c;
        v.clear();
        v1.clear();
        for(i=0; i<c; i++)
        {
            cin>>d;
            v.push_back(d);
            v1.push_back(d);
        }
        sort(v1.begin(),v1.end());
        e=bala(v,v1,c);
        if(e==0)
        {
            cout<<e<<endl;
        }
        if((floor(log2(e))==ceil(log2(e))) &&  (e!=0))
        {
            cout<<log2(e)+1<<endl;
        }
        else if((floor(log2(e))!=ceil(log2(e))) && (e!=0))
        {
            cout<<ceil(log2(e))<<endl;
        }
        b++;

    }

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define MOD 1000000007
#define fi first
#define se second
#define rep(i,n) for(ll i = 0 ; i < n ; i++)
#define repe(i,n) for(ll i = 0 ; i <= n ; i++)
#define repb(i,a,b) for(ll i = a ; i < b ; i++)
#define repeb(i,a,b) for(ll i = a ; i <= b ; i++)
#define rfor(i,n,a) for(ll i = n ; i >= a ; i--)
#define pb push_back
#define popb pop_back()
#define endl "\n"
#define pii pair < long long, long long >
typedef priority_queue<ll, vector<ll>, greater<ll>> minheap;
typedef priority_queue<ll> maxheap;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a,b) cout << a << " " << b << endl
#define p3(a,b,c) cout << a << " " << b << " " << c << endl
#define p4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl
#define sortv(v) sort(v.begin(),v.end())
#define rsortv(v) sort(v.begin(),v.end(), greater<>());
#define sortby(v,prop) sort( v.begin( ), v.end( ), [ ]( const auto& lhs, const auto& rhs ){ return lhs.prop < rhs.prop; });
#define rsortby(v,prop) sort( v.begin( ), v.end( ), [ ]( const auto& lhs, const auto& rhs ){ return lhs.prop > rhs.prop; });

ll modPower(ll num,ll r) {
	if(r==0) return 1;
	if(r==1) return num%MOD;
	ll ans=modPower(num,r/2)%MOD;
	if(r%2==0) {
		return (ans*ans)%MOD;
	} return (((ans*ans)%MOD)*num)%MOD;
}

/*-------------------------------------------------*/

// find smallest x for 2^x -1 >= d
#define vi vector<ll>
// vector<ll> power2(33,-1);

ll best(ll d) {
	// p1(d);
	// p1(powl(2,31));
	ll l = 1, h = 32;

	while(l <= h) {
		ll mid = (l+h)/2;
		ll x = powl(2,mid);

		// p2(x,mid);

		if((x-1 >= d) && ((x/2)-1) < d) {
			return mid;
		} else if(x-1 < d) {
			l = mid + 1;
		} else {
			h = mid-1;
		}
	}

	return -1;
}

void solve() {

	ll n, diff = 0;
	cin >> n;
	ll a[n];

	rep(i,n) cin >> a[i];
	ll mx = a[0];

	repb(i,1,n) {

		if(a[i] < mx) {
			diff = max(diff, mx-a[i]);
		}
		mx = max(mx,a[i]);
	}

	// biggest diff to be covered
	ll ans = 0;
	if(diff > 0) ans = best(diff);
	p1(ans);
}

int main()
{
	fastio;
	int tc;
	cin >> tc;

	while(tc--)	{
		solve();
	}

	return 0;
}

/*
1
5
5 -10 2 -9 -5
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define MOD 1000000007
#define fi first
#define se second
#define rep(i,n) for(ll i = 0 ; i < n ; i++)
#define repe(i,n) for(ll i = 0 ; i <= n ; i++)
#define repb(i,a,b) for(ll i = a ; i < b ; i++)
#define repeb(i,a,b) for(ll i = a ; i <= b ; i++)
#define rfor(i,n,a) for(ll i = n ; i >= a ; i--)
#define pb push_back
#define popb pop_back()
#define endl "\n"
#define pii pair < long long, long long >
typedef priority_queue<ll, vector<ll>, greater<ll>> minheap;
typedef priority_queue<ll> maxheap;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a,b) cout << a << " " << b << endl
#define p3(a,b,c) cout << a << " " << b << " " << c << endl
#define p4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl
#define sortv(v) sort(v.begin(),v.end())
#define rsortv(v) sort(v.begin(),v.end(), greater<>());
#define sortby(v,prop) sort( v.begin( ), v.end( ), [ ]( const auto& lhs, const auto& rhs ){ return lhs.prop < rhs.prop; });
#define rsortby(v,prop) sort( v.begin( ), v.end( ), [ ]( const auto& lhs, const auto& rhs ){ return lhs.prop > rhs.prop; });

ll modPower(ll num,ll r) {
	if(r==0) return 1;
	if(r==1) return num%MOD;
	ll ans=modPower(num,r/2)%MOD;
	if(r%2==0) {
		return (ans*ans)%MOD;
	} return (((ans*ans)%MOD)*num)%MOD;
}

/*-------------------------------------------------*/

// find smallest x for 2^x -1 >= d
#define vi vector<ll>
vector<ll> power2(33,-1);

ll best(ll d) {
	// p1(d);
	// p1(powl(2,31));
	ll l = 1, h = 32;

	while(l <= h) {
		ll mid = (l+h)/2, x;

		if(power2[mid] == -1) {
			x = powl(2,mid);
			power2[mid] = x;
		} else {
			x = power2[mid];
		}
		// p2(x,mid);

		if((x-1 >= d) && ((x/2)-1) < d) {
			return mid;
		} else if(x-1 < d) {
			l = mid + 1;
		} else {
			h = mid-1;
		}
	}

	return -1;
}

void solve() {

	ll n, x = 0, carry = 0, i = 1;
	cin >> n;
	ll a[n];

	rep(i,n) cin >> a[i];

	while(i<n) {

		if(a[i] < a[i-1]) {
			ll c = best(a[i-1] - a[i]);
			a[i] += (power2[c]-1);
			// p3(i,c,a[i]);
			x = max(x,c);
		}
		i++;
	}

	p1(x);
}

int main()
{
	fastio;
	int tc;
	cin >> tc;

	while(tc--)	{
		solve();
	}

	return 0;
}

/*
1
5
5 -10 2 -9 -5
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define MOD 1000000007
#define fi first
#define se second
#define rep(i,n) for(ll i = 0 ; i < n ; i++)
#define repe(i,n) for(ll i = 0 ; i <= n ; i++)
#define repb(i,a,b) for(ll i = a ; i < b ; i++)
#define repeb(i,a,b) for(ll i = a ; i <= b ; i++)
#define rfor(i,n,a) for(ll i = n ; i >= a ; i--)
#define pb push_back
#define popb pop_back()
#define endl "\n"
#define pii pair < long long, long long >
typedef priority_queue<ll, vector<ll>, greater<ll>> minheap;
typedef priority_queue<ll> maxheap;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a,b) cout << a << " " << b << endl
#define p3(a,b,c) cout << a << " " << b << " " << c << endl
#define p4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl
#define sortv(v) sort(v.begin(),v.end())
#define rsortv(v) sort(v.begin(),v.end(), greater<>());
#define sortby(v,prop) sort( v.begin( ), v.end( ), [ ]( const auto& lhs, const auto& rhs ){ return lhs.prop < rhs.prop; });
#define rsortby(v,prop) sort( v.begin( ), v.end( ), [ ]( const auto& lhs, const auto& rhs ){ return lhs.prop > rhs.prop; });

ll modPower(ll num,ll r) {
	if(r==0) return 1;
	if(r==1) return num%MOD;
	ll ans=modPower(num,r/2)%MOD;
	if(r%2==0) {
		return (ans*ans)%MOD;
	} return (((ans*ans)%MOD)*num)%MOD;
}

/*-------------------------------------------------*/

// find smallest x for 2^x -1 >= d

ll best(ll d) {

	int l = 1, h = 30;

	while(l <= h) {
		int mid = (l+h)/2;

		ll x = 1 << mid;

		if((x-1 >= d) && ((x>>1)-1) < d) {
			return mid;
		} else if(x-1 < d) {
			l = mid + 1;
		} else {
			h = mid-1;
		}
	}

	return -1;
}

void solve() {

	ll n, x = 0, carry = 0, i = 1;
	cin >> n;
	ll a[n];
	rep(i,n) cin >> a[i];

	while(i<n) {

		if(a[i] < a[i-1]) {
			ll c = best(a[i-1] - a[i]);
			a[i] += (1<<c)-1;
			// p3(i,c,a[i]);
			x = max(x,c);
		}
		i++;
	}

	p1(x);
}

int main()
{
	fastio;
	int tc;
	cin >> tc;

	while(tc--)	{
		solve();
	}

	return 0;
}

/*
1
5
5 -10 2 -9 -5
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define MOD 1000000007
#define fi first
#define se second
#define rep(i,n) for(ll i = 0 ; i < n ; i++)
#define repe(i,n) for(ll i = 0 ; i <= n ; i++)
#define repb(i,a,b) for(ll i = a ; i < b ; i++)
#define repeb(i,a,b) for(ll i = a ; i <= b ; i++)
#define rfor(i,n,a) for(ll i = n ; i >= a ; i--)
#define pb push_back
#define popb pop_back()
#define endl "\n"
#define pii pair < long long, long long >
typedef priority_queue<ll, vector<ll>, greater<ll>> minheap;
typedef priority_queue<ll> maxheap;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a,b) cout << a << " " << b << endl
#define p3(a,b,c) cout << a << " " << b << " " << c << endl
#define p4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl
#define sortv(v) sort(v.begin(),v.end())
#define rsortv(v) sort(v.begin(),v.end(), greater<>());
#define sortby(v,prop) sort( v.begin( ), v.end( ), [ ]( const auto& lhs, const auto& rhs ){ return lhs.prop < rhs.prop; });
#define rsortby(v,prop) sort( v.begin( ), v.end( ), [ ]( const auto& lhs, const auto& rhs ){ return lhs.prop > rhs.prop; });

ll modPower(ll num,ll r) {
	if(r==0) return 1;
	if(r==1) return num%MOD;
	ll ans=modPower(num,r/2)%MOD;
	if(r%2==0) {
		return (ans*ans)%MOD;
	} return (((ans*ans)%MOD)*num)%MOD;
}

/*-------------------------------------------------*/

void solve() {

	ll n, x = 0, carry = 0, i = 1;
	cin >> n;
	ll a[n];
	rep(i,n) cin >> a[i];

	while(i<n) {
		a[i] += carry;

		while(a[i] < a[i-1]) {
			ll c = (1 << x);
			a[i] += c;
			carry += c;
			x++;
			// p1(a[i]);
		}
		i++;
	}

	p1(x);
}

int main()
{
	fastio;
	int tc;
	cin >> tc;

	while(tc--)	{
		solve();
	}

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define MOD 1000000007
#define fi first
#define se second
#define rep(i,n) for(ll i = 0 ; i < n ; i++)
#define repe(i,n) for(ll i = 0 ; i <= n ; i++)
#define repb(i,a,b) for(ll i = a ; i < b ; i++)
#define repeb(i,a,b) for(ll i = a ; i <= b ; i++)
#define rfor(i,n,a) for(ll i = n ; i >= a ; i--)
#define pb push_back
#define popb pop_back()
#define endl "\n"
#define pii pair < long long, long long >
typedef priority_queue<ll, vector<ll>, greater<ll>> minheap;
typedef priority_queue<ll> maxheap;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a,b) cout << a << " " << b << endl
#define p3(a,b,c) cout << a << " " << b << " " << c << endl
#define p4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl
#define sortv(v) sort(v.begin(),v.end())
#define rsortv(v) sort(v.begin(),v.end(), greater<>());
#define sortby(v,prop) sort( v.begin( ), v.end( ), [ ]( const auto& lhs, const auto& rhs ){ return lhs.prop < rhs.prop; });
#define rsortby(v,prop) sort( v.begin( ), v.end( ), [ ]( const auto& lhs, const auto& rhs ){ return lhs.prop > rhs.prop; });

ll modPower(ll num,ll r) {
	if(r==0) return 1;
	if(r==1) return num%MOD;
	ll ans=modPower(num,r/2)%MOD;
	if(r%2==0) {
		return (ans*ans)%MOD;
	} return (((ans*ans)%MOD)*num)%MOD;
}

/*-------------------------------------------------*/

ll best(ll d) {

	ll l = 1, h = 32;

	while(l <= h) {
		ll mid = (l+h)/2;
		ll x = powl(2,mid);

		if((x-1 >= d) && ((x/2)-1) < d) {
			return mid;
		} else if(x-1 < d) {
			l = mid + 1;
		} else {
			h = mid-1;
		}
	}

	return -1;
}

void solve() {

	ll n, diff = 0;
	cin >> n;
	ll a[n];

	rep(i,n) cin >> a[i];
	ll mx = a[0];

	// get biggest diff to be covered
	repb(i,1,n) {

		if(a[i] < mx) {
			diff = max(diff, mx-a[i]);
		}
		mx = max(mx,a[i]);
	}

	ll ans = 0;
	// number of steps to cover the distance
	if(diff > 0) ans = best(diff);
	p1(ans);
}

int main()
{
	fastio;
	int tc;
	cin >> tc;

	while(tc--)	{
		solve();
	}

	return 0;
}

/*
1
5
5 -10 2 -9 -5
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define MOD 1000000007
#define fi first
#define se second
#define rep(i,n) for(ll i = 0 ; i < n ; i++)
#define repe(i,n) for(ll i = 0 ; i <= n ; i++)
#define repb(i,a,b) for(ll i = a ; i < b ; i++)
#define repeb(i,a,b) for(ll i = a ; i <= b ; i++)
#define rfor(i,n,a) for(ll i = n ; i >= a ; i--)
#define pb push_back
#define popb pop_back()
#define endl "\n"
#define pii pair < long long, long long >
typedef priority_queue<ll, vector<ll>, greater<ll>> minheap;
typedef priority_queue<ll> maxheap;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a,b) cout << a << " " << b << endl
#define p3(a,b,c) cout << a << " " << b << " " << c << endl
#define p4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl
#define sortv(v) sort(v.begin(),v.end())
#define rsortv(v) sort(v.begin(),v.end(), greater<>());
#define sortby(v,prop) sort( v.begin( ), v.end( ), [ ]( const auto& lhs, const auto& rhs ){ return lhs.prop < rhs.prop; });
#define rsortby(v,prop) sort( v.begin( ), v.end( ), [ ]( const auto& lhs, const auto& rhs ){ return lhs.prop > rhs.prop; });

ll modPower(ll num,ll r) {
	if(r==0) return 1;
	if(r==1) return num%MOD;
	ll ans=modPower(num,r/2)%MOD;
	if(r%2==0) {
		return (ans*ans)%MOD;
	} return (((ans*ans)%MOD)*num)%MOD;
}

/*-------------------------------------------------*/

// find smallest x for 2^x -1 >= d

ll best(ll d) {
	// p1(d);
	// p1(powl(2,31));
	ll l = 1, h = 31;

	while(l <= h) {
		ll mid = (l+h)/2;

		ll x = powl(2,mid);
		// p2(x,mid);

		if((x-1 >= d) && ((x/2)-1) < d) {
			return mid;
		} else if(x-1 < d) {
			l = mid + 1;
		} else {
			h = mid-1;
		}
	}

	return -1;
}

void solve() {

	ll n, x = 0, carry = 0, i = 1;
	cin >> n;
	ll a[n];
	rep(i,n) cin >> a[i];

	while(i<n) {

		if(a[i] < a[i-1]) {
			ll c = best(a[i-1] - a[i]);
			a[i] += (1<<c)-1;
			// p3(i,c,a[i]);
			x = max(x,c);
		}
		i++;
	}

	p1(x);
}

int main()
{
	fastio;
	int tc;
	cin >> tc;

	while(tc--)	{
		solve();
	}

	return 0;
}

/*
1
5
5 -10 2 -9 -5
*/


/*|In The Name of Allah|*/
/* Dear GCC compiler:
*
* If my code doesn't compile, this doesn't mean it's wrong.
* It just mean that you don't understand what I want.
* Here's my safety pig, I hope my code compile and get accepted.
* _._ _..._ .-',     _.._(`))
*'-. `     '  /-._.-'    ',/
*   )         \            '.
*  / _    _    |             \
* |  a    a    /              |
* \   .-.                     ;
*  '-('' ).-'       ,'       ;
*     '-;           |      .'
*        \           \    /
*        | 7  .__  _.-\   \
*        | |  |  ``/  /`  /
*       /,_|  |   /,_/   /
*          /,_/      '`-'
*/
#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y){
if (y == 0)
	return 1;
long long ret = power(x , y >> 1) %1000000007 ;
if (y % 2 == 0)
	return (ret * ret) % 1000000007;
else
	return (x * (ret * ret % 1000000007)) % 1000000007;
}

pair<int, int> norm(pair<int, int> p)
{
	if(p.first < 0)
	{
		p.first *= -1;
		p.second *= -1;
	}
	else if (p.first == 0 && p.second < 0)
	{
		p.second *= -1;
	}
	int d = __gcd(abs(p.first), abs(p.second));
	p.first /= d;
	p.second /= d;
	return p;
}

/*

int parent[N], sz[N];
int n, m, components;

void init(){
  iota(parent, parent+n, 0);
  fill(sz, sz+n, 1);
  components = n;
}

int find(int u){
  if(parent[u] == u)  return u;
  return parent[u] = find(parent[u]);
}

void join(int u, int v){
  u = find(u), v = find(v);
  if(u == v)  return;
  if(sz[u] < sz[v]) swap(u, v);
  parent[v] = u;
  sz[u] += sz[v];
  --components;
}
int dst[N];
int vis[N];
int parent[N];
vector<vector<pair<int,ll>>>v(N);
void dikstra(){
	set<pair<ll,ll>>s;
	clr(dst,oo);
	clr(vis,0);
	clr(parent,-1);
	dst[1]=0;
	parent[1]=-1;
	s.insert( mp(0,1 ) );
	while(!s.empty()){

		pair<ll,ll> x=*s.begin();
		s.erase(s.begin());
		ll u=x.sc;
		ll d=x.fr;
		if (vis[u])continue;
		vis[u]=1;
		for (int i=0;i<v[u].size();i++){
			ll to=v[u][i].fr;
			ll cost=v[u][i].sc;
			if (vis[to]||d+cost>=dst[to])continue;
			dst[to]=d+cost;
			parent[to]=u;
			s.insert(mp(d+cost,to));
		}
	}

return;
}
void primeFactors(int n)
{
    while (n % 2 == 0){
        n = n/2;
    }

    for (int i = 3; i <= sqrt(n); i = i + 2)
    {
        while (n % i == 0){
            cout << i << " ";
            n = n/i;
        }
    }
    if (n > 2){

    }
}

void Theaf(){
isPrime[0]=1;
isPrime[1]=1;
for (int i=2;i*i<=N;i++){
	if (isPrime[i]==1)continue;
	for (int cnt=2;i*cnt<=N;cnt++)isPrime[ cnt*i ]=1;
}

}
void dfs_EdgeClassification(int node)
{
	start[node] = timer++;

	rep(i, adj[node])
	{
		int child = adj[node][i];
		if (start[child] == -1)	// Not visited Before. Treed Edge
			dfs_EdgeClassification(child);
		else {
			if(finish[child] == -1)// then this is ancestor that called us and waiting us to finish. Then Cycle. Back Edge
				anyCycle = 1;
			else if(start[node] < start[child])	// then you are my descendant
				;	// Forward Edge
			else
				;	// Cross Edge
		}
	}

	finish[node] = timer++;
}

vectorll factorization(ll n) 	 max n is 1e12
{	// O( sqrt(n) )

	vectorll primes;

	for (ll i = 2; i  i * i <= n; ++i)	 Improve start by i = 3.
		while (n % i == 0)
			primes.push_back(i), n /= i;	 Get every prime inside n.	n  i^j	is a new number

	 Two ways to prove that n will be prime number if n  1
	 1) Think in n  pi^x as a NEW sub-problem. If we went to its sqrt and % applied, then we are facing a prime number
	 2) Prove that, for any n either all its primes before sqrt(n), or only the biggest prime after sqrt(n).
	if (n  > 1)
		primes.push_back(n);

	return primes;
}
int mod(string num, int a)
{
    // Initialize result
    int res = 0;

    // One by one process all digits of 'num'
    for (int i = 0; i < num.length(); i++)
         res = (res*10 + (int)num[i] - '0') %a;

    return res;
}

struct uf{
	static const int MAXN=105;
	int par[MAXN];
	int size[MAXN];
	void init(){
		memset(par,-1,sizeof(par));
		REP(i,MAXN) size[i]=1;
	}
	int root(int a){
		if(par[a]==-1) return a;
		return par[a]=root(par[a]);
	}
	void unite(int a,int b){
		a=root(a);b=root(b);
		if(a==b) return;
		if(size[a]<size[b]) swap(a,b);

		par[b]=a;
		size[a]+=size[b];
	}
	bool same(int a,int b){
		return root(a)==root(b);
	}
};
uf u_[105];
int mood(string num, int a)
{
    // Initialize result
    int res = 0;

    // One by one process all digits of 'num'
    for (int i = 0; i < (int)num.length(); i++)
         res = (res*10 + (int)num[i] - '0') %a;

    return res;
}

*/
const double Eps =(1e-7);
int dcmp(double x,double y){ return fabs(x-y)<=Eps? 0: x<y ?-1:1; }

typedef long long  ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<pair<int,int> > vii;
typedef map<int, int> mii;
typedef map<string, int> msi;
typedef pair<int, int> pii;
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define sll set <ll>
#define spii set <pii>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1,v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1,v2,v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define el	'\n'
#define lp(i,n) for(int i = 0;i < int(n);i++)
#define lp1(i,n) for(int i = 1;i <= int(n);i++)
#define rlp(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rng(i,a,b) for(int i = int(a);i <= int(b);i++)
#define mp(x,y)  	make_pair((x),(y))
#define pb(x)    	push_back((x))
#define all(v)  	((v).begin()),((v).end())
#define sz(x)  		((int) (x).size())
#define bits(a) 	__builtin_popcountll(a)
#define fr first
#define sc second
#define pii pair<int, int>
#define sortva(v) sort(all(v))
#define sortvd(v) sort(v.rbegin(),v.rend())
#define sortaa(a,n) sort(a,a+n)
#define sortad(a,n) sort(a,a+n),reverse(a,a+n)
#define SS stringstream
#define ll long long
#define clr(x, y) memset(x, y, sizeof(x))
#define foreach(it,x) for(__typeof__((x).begin()) it = (x).begin(); it != (x).end(); ++it)
#define read freopen("input.in", "rt", stdin);
#define write freopen("output.in", "wt", stdout);
#define fastIO cout << fixed << setprecision(0), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
int kx[] = { 2, 2, 1, -1, -2, -2, 1, -1 };
int ky[] = { 1, -1, 2, 2, 1, -1, -2, -2 };
ll gcd(ll a, ll b){if (a == 0)return b;return gcd(b % a, a);}
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }

ll const N =(int)5e5+9, mod = 100000000 , oo = 1e9+7;

//------------------------------------------------------------------------------------

ll t,n;
ll arr[N];
ll prefex[N];
int main()
{
	cin>>t;
	lp1(i,35)prefex[i]=((ll)1<<(i-1));
	lp1(i,35)prefex[i]=prefex[i-1]+prefex[i];

	while(t--){
		cin>>n;
		ll k=0;
		lp1(i,n)cin>>arr[i];
		for (int i=2;i<=n;i++){
			if (arr[i]>=arr[i-1]);
				else {
					ll x=arr[i-1]-arr[i];
					ll idx=lower_bound(prefex,prefex+33,x)-prefex;
					if (idx<=k)arr[i]+=prefex[idx];
					else {
						k=idx;
						arr[i]+=prefex[k];
					}
				}
		}

		cout<< k<<endl;

	}

/*
*/

return 0;
}


/*|In The Name of Allah|*/
/* Dear GCC compiler:
*
* If my code doesn't compile, this doesn't mean it's wrong.
* It just mean that you don't understand what I want.
* Here's my safety pig, I hope my code compile and get accepted.
* _._ _..._ .-',     _.._(`))
*'-. `     '  /-._.-'    ',/
*   )         \            '.
*  / _    _    |             \
* |  a    a    /              |
* \   .-.                     ;
*  '-('' ).-'       ,'       ;
*     '-;           |      .'
*        \           \    /
*        | 7  .__  _.-\   \
*        | |  |  ``/  /`  /
*       /,_|  |   /,_/   /
*          /,_/      '`-'
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

using namespace std;
using namespace  __gnu_pbds;
long long  mood=1e14;

long long power(long long x, long long y,long long mood){
if (y == 0)
	return 1;
long long ret = power(x , y >> 1,mood) %mood ;
if (y % 2 == 0)
	return (ret * ret) % mood;
else
	return (x * (ret * ret % mood)) % mood;
}

pair<int, int> norm(pair<int, int> p)
{
	if(p.first < 0)
	{
		p.first *= -1;
		p.second *= -1;
	}
	else if (p.first == 0 && p.second < 0)
	{
		p.second *= -1;
	}
	int d = __gcd(abs(p.first), abs(p.second));
	p.first /= d;
	p.second /= d;
	return p;
}

/*

int parent[N], sz[N];
int n, m, components;

void init(){
  iota(parent, parent+N, 0);
  fill(sz, sz+N, 1);
  components = N;
}

int find(int u){
  if(parent[u] == u)  return u;
  return parent[u] = find(parent[u]);
}

void join(int u, int v){
  u = find(u), v = find(v);
  if(u == v)  return;
  if(sz[u] < sz[v]) swap(u, v);
  parent[v] = u;
  sz[u] += sz[v];
  --components;
}
int dst[N];
int vis[N];
int parent[N];
vector<vector<pair<int,ll>>>v(N);
void dikstra(){
	set<pair<ll,ll>>s;
	clr(dst,oo);
	clr(vis,0);
	clr(parent,-1);
	dst[1]=0;
	parent[1]=-1;
	s.insert( mp(0,1 ) );
	while(!s.empty()){

		pair<ll,ll> x=*s.begin();
		s.erase(s.begin());
		ll u=x.sc;
		ll d=x.fr;
		if (vis[u])continue;
		vis[u]=1;
		for (int i=0;i<v[u].size();i++){
			ll to=v[u][i].fr;
			ll cost=v[u][i].sc;
			if (vis[to]||d+cost>=dst[to])continue;
			dst[to]=d+cost;
			parent[to]=u;
			s.insert(mp(d+cost,to));
		}
	}

return;
}
void primeFactors(int n)
{
	while (n % 2 == 0){
		n = n/2;
	}

	for (int i = 3; i <= sqrt(n); i = i + 2)
	{
		while (n % i == 0){
			cout << i << " ";
			n = n/i;
		}
	}
	if (n > 2){

	}
}

void Theaf(){
isPrime[0]=1;
isPrime[1]=1;
for (int i=2;i*i<=N;i++){
	if (isPrime[i]==1)continue;
	for (int cnt=2;i*cnt<=N;cnt++)isPrime[ cnt*i ]=1;
}

}
void dfs_EdgeClassification(int node)
{
	start[node] = timer++;

	rep(i, adj[node])
	{
		int child = adj[node][i];
		if (start[child] == -1)	// Not visited Before. Treed Edge
			dfs_EdgeClassification(child);
		else {
			if(finish[child] == -1)// then this is ancestor that called us and waiting us to finish. Then Cycle. Back Edge
				anyCycle = 1;
			else if(start[node] < start[child])	// then you are my descendant
				;	// Forward Edge
			else
				;	// Cross Edge
		}
	}

	finish[node] = timer++;
}

vectorll factorization(ll n) 	 max n is 1e12
{	// O( sqrt(n) )

	vectorll primes;

	for (ll i = 2; i  i * i <= n; ++i)	 Improve start by i = 3.
		while (n % i == 0)
			primes.push_back(i), n /= i;	 Get every prime inside n.	n  i^j	is a new number

	 Two ways to prove that n will be prime number if n  1
	 1) Think in n  pi^x as a NEW sub-problem. If we went to its sqrt and % applied, then we are facing a prime number
	 2) Prove that, for any n either all its primes before sqrt(n), or only the biggest prime after sqrt(n).
	if (n  > 1)
		primes.push_back(n);

	return primes;
}

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

	ordered_set X;
	X.insert(1);
	X.insert(2);
	X.insert(4);
	X.insert(8);
	X.insert(16);

	0 1 2 3 4
	1 2 4 8 16
	cout<<*X.find_by_order(1)<<endl; // 2
	cout<<*X.find_by_order(2)<<endl; // 4
	cout<<*X.find_by_order(4)<<endl; // 16
	cout<<(end(X)==X.find_by_order(6))<<endl; // true

	cout<<X.order_of_key(-5)<<endl;  // 0
	cout<<X.order_of_key(1)<<endl;   // 0
	cout<<X.order_of_key(3)<<endl;   // 2
	cout<<X.order_of_key(4)<<endl;   // 2
	cout<<X.order_of_key(400)<<endl; // 5

int t = 0;

ordered_set me;
...
me.insert({x, t++});
me.erase(me.lower_bound({x, 0}));
cout << me.order_of_key({x, 0}) << "\n";

*/
const double Eps =(1e-7);
int dcmp(double x,double y){ return fabs(x-y)<=Eps? 0: x<y ?-1:1; }
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_setpair;
typedef long long  ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<pair<int,int> > vii;
typedef map<int, int> mii;
typedef map<string, int> msi;
typedef pair<int, int> pii;
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define sll set <ll>
#define spii set <pii>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1,v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1,v2,v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define el	'\n'
#define lp(i,n) for(int i = 0;i < int(n);i++)
#define lp1(i,n) for(int i = 1;i <= int(n);i++)
#define rlp(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rng(i,a,b) for(int i = int(a);i <= int(b);i++)
#define mp(x,y)  	make_pair((x),(y))
#define pb(x)    	push_back((x))
#define all(v)  	((v).begin()),((v).end())
#define sz(x)  		((int) (x).size())
#define bits(a) 	__builtin_popcountll(a)
#define fr first
#define sc second
#define pii pair<int, int>
#define sortva(v) sort(all(v))
#define sortvd(v) sort(v.rbegin(),v.rend())
#define sortaa(a,n) sort(a,a+n)
#define sortad(a,n) sort(a,a+n),reverse(a,a+n)
#define SS stringstream
#define ll long long
#define clr(x, y) memset(x, y, sizeof(x))
#define foreach(it,x) for(__typeof__((x).begin()) it = (x).begin(); it != (x).end(); ++it)
#define read freopen("input.in", "rt", stdin);
#define write freopen("output.in", "wt", stdout);
#define fastIO cout << fixed << setprecision(0), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
const long long  P = (31);
const long long  key2 = 59;
int dx[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
int dy[] = { 1, 0, -1, 0, -1, 1, 1, -1 };
int kx[] = { 2, 2, 1, -1, -2, -2, 1, -1 };
int ky[] = { 1, -1, 2, 2, 1, -1, -2, -2 };
ll gcd(ll a, ll b){if (a == 0)return b;return gcd(b % a, a);}
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }

int const N = 5e5+9, mod = 1e9+7 ,  oo = 1e9+7;

//------------------------------------------------------------------------------------

ll t,n;
ll arr[N];
ll prefex[N];
int main()
{
	cin>>t;
	lp1(i,35)prefex[i]=((ll)1<<(i-1));
	while(t--){
		cin>>n;
		ll k=0;
		lp1(i,n)cin>>arr[i];
		for (int i=2;i<=n;i++){
			if (arr[i]>=arr[i-1]);
				else {
					ll x=arr[i-1]-arr[i];
					ll idx=lower_bound(prefex,prefex+33,x)-prefex;
					arr[i]=arr[i-1];
					if (prefex[idx]>x)idx--;
					k=max(k,idx);
				}
		}

		cout<< k<<endl;

	}

/*
*/
return 0;
}


/*|In The Name of Allah|*/
/* Dear GCC compiler:
*
* If my code doesn't compile, this doesn't mean it's wrong.
* It just mean that you don't understand what I want.
* Here's my safety pig, I hope my code compile and get accepted.
* _._ _..._ .-',     _.._(`))
*'-. `     '  /-._.-'    ',/
*   )         \            '.
*  / _    _    |             \
* |  a    a    /              |
* \   .-.                     ;
*  '-('' ).-'       ,'       ;
*     '-;           |      .'
*        \           \    /
*        | 7  .__  _.-\   \
*        | |  |  ``/  /`  /
*       /,_|  |   /,_/   /
*          /,_/      '`-'
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

using namespace std;
using namespace  __gnu_pbds;
long long  mood=1e14;

long long power(long long x, long long y,long long mood){
if (y == 0)
	return 1;
long long ret = power(x , y >> 1,mood) %mood ;
if (y % 2 == 0)
	return (ret * ret) % mood;
else
	return (x * (ret * ret % mood)) % mood;
}

pair<int, int> norm(pair<int, int> p)
{
	if(p.first < 0)
	{
		p.first *= -1;
		p.second *= -1;
	}
	else if (p.first == 0 && p.second < 0)
	{
		p.second *= -1;
	}
	int d = __gcd(abs(p.first), abs(p.second));
	p.first /= d;
	p.second /= d;
	return p;
}

/*

int parent[N], sz[N];
int n, m, components;

void init(){
  iota(parent, parent+N, 0);
  fill(sz, sz+N, 1);
  components = N;
}

int find(int u){
  if(parent[u] == u)  return u;
  return parent[u] = find(parent[u]);
}

void join(int u, int v){
  u = find(u), v = find(v);
  if(u == v)  return;
  if(sz[u] < sz[v]) swap(u, v);
  parent[v] = u;
  sz[u] += sz[v];
  --components;
}
int dst[N];
int vis[N];
int parent[N];
vector<vector<pair<int,ll>>>v(N);
void dikstra(){
	set<pair<ll,ll>>s;
	clr(dst,oo);
	clr(vis,0);
	clr(parent,-1);
	dst[1]=0;
	parent[1]=-1;
	s.insert( mp(0,1 ) );
	while(!s.empty()){

		pair<ll,ll> x=*s.begin();
		s.erase(s.begin());
		ll u=x.sc;
		ll d=x.fr;
		if (vis[u])continue;
		vis[u]=1;
		for (int i=0;i<v[u].size();i++){
			ll to=v[u][i].fr;
			ll cost=v[u][i].sc;
			if (vis[to]||d+cost>=dst[to])continue;
			dst[to]=d+cost;
			parent[to]=u;
			s.insert(mp(d+cost,to));
		}
	}

return;
}
void primeFactors(int n)
{
	while (n % 2 == 0){
		n = n/2;
	}

	for (int i = 3; i <= sqrt(n); i = i + 2)
	{
		while (n % i == 0){
			cout << i << " ";
			n = n/i;
		}
	}
	if (n > 2){

	}
}

void Theaf(){
isPrime[0]=1;
isPrime[1]=1;
for (int i=2;i*i<=N;i++){
	if (isPrime[i]==1)continue;
	for (int cnt=2;i*cnt<=N;cnt++)isPrime[ cnt*i ]=1;
}

}
void dfs_EdgeClassification(int node)
{
	start[node] = timer++;

	rep(i, adj[node])
	{
		int child = adj[node][i];
		if (start[child] == -1)	// Not visited Before. Treed Edge
			dfs_EdgeClassification(child);
		else {
			if(finish[child] == -1)// then this is ancestor that called us and waiting us to finish. Then Cycle. Back Edge
				anyCycle = 1;
			else if(start[node] < start[child])	// then you are my descendant
				;	// Forward Edge
			else
				;	// Cross Edge
		}
	}

	finish[node] = timer++;
}

vectorll factorization(ll n) 	 max n is 1e12
{	// O( sqrt(n) )

	vectorll primes;

	for (ll i = 2; i  i * i <= n; ++i)	 Improve start by i = 3.
		while (n % i == 0)
			primes.push_back(i), n /= i;	 Get every prime inside n.	n  i^j	is a new number

	 Two ways to prove that n will be prime number if n  1
	 1) Think in n  pi^x as a NEW sub-problem. If we went to its sqrt and % applied, then we are facing a prime number
	 2) Prove that, for any n either all its primes before sqrt(n), or only the biggest prime after sqrt(n).
	if (n  > 1)
		primes.push_back(n);

	return primes;
}

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

	ordered_set X;
	X.insert(1);
	X.insert(2);
	X.insert(4);
	X.insert(8);
	X.insert(16);

	0 1 2 3 4
	1 2 4 8 16
	cout<<*X.find_by_order(1)<<endl; // 2
	cout<<*X.find_by_order(2)<<endl; // 4
	cout<<*X.find_by_order(4)<<endl; // 16
	cout<<(end(X)==X.find_by_order(6))<<endl; // true

	cout<<X.order_of_key(-5)<<endl;  // 0
	cout<<X.order_of_key(1)<<endl;   // 0
	cout<<X.order_of_key(3)<<endl;   // 2
	cout<<X.order_of_key(4)<<endl;   // 2
	cout<<X.order_of_key(400)<<endl; // 5

int t = 0;

ordered_set me;
...
me.insert({x, t++});
me.erase(me.lower_bound({x, 0}));
cout << me.order_of_key({x, 0}) << "\n";

*/
const double Eps =(1e-7);
int dcmp(double x,double y){ return fabs(x-y)<=Eps? 0: x<y ?-1:1; }
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_setpair;
typedef long long  ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<pair<int,int> > vii;
typedef map<int, int> mii;
typedef map<string, int> msi;
typedef pair<int, int> pii;
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define sll set <ll>
#define spii set <pii>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1,v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1,v2,v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define el	'\n'
#define lp(i,n) for(int i = 0;i < int(n);i++)
#define lp1(i,n) for(int i = 1;i <= int(n);i++)
#define rlp(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rng(i,a,b) for(int i = int(a);i <= int(b);i++)
#define mp(x,y)  	make_pair((x),(y))
#define pb(x)    	push_back((x))
#define all(v)  	((v).begin()),((v).end())
#define sz(x)  		((int) (x).size())
#define bits(a) 	__builtin_popcountll(a)
#define fr first
#define sc second
#define pii pair<int, int>
#define sortva(v) sort(all(v))
#define sortvd(v) sort(v.rbegin(),v.rend())
#define sortaa(a,n) sort(a,a+n)
#define sortad(a,n) sort(a,a+n),reverse(a,a+n)
#define SS stringstream
#define ll long long
#define clr(x, y) memset(x, y, sizeof(x))
#define foreach(it,x) for(__typeof__((x).begin()) it = (x).begin(); it != (x).end(); ++it)
#define read freopen("input.in", "rt", stdin);
#define write freopen("output.in", "wt", stdout);
#define fastIO cout << fixed << setprecision(0), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
const long long  P = (31);
const long long  key2 = 59;
int dx[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
int dy[] = { 1, 0, -1, 0, -1, 1, 1, -1 };
int kx[] = { 2, 2, 1, -1, -2, -2, 1, -1 };
int ky[] = { 1, -1, 2, 2, 1, -1, -2, -2 };
ll gcd(ll a, ll b){if (a == 0)return b;return gcd(b % a, a);}
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }

int const N = 5e5+9, mod = 1e9+7 ,  oo = 1e9+7;

//------------------------------------------------------------------------------------

ll t,n;
ll arr[N];
ll prefex[N];
int main()
{
	cin>>t;
	lp1(i,35)prefex[i]=((ll)1<<(i-1));
	lp1(i,35)prefex[i]=prefex[i-1]+prefex[i];

	while(t--){
		cin>>n;
		ll k=0;
		lp1(i,n)cin>>arr[i];
		for (int i=2;i<=n;i++){
			if (arr[i]>=arr[i-1]);
				else {
					ll x=arr[i-1]-arr[i];
					ll idx=lower_bound(prefex,prefex+33,x)-prefex;
					arr[i]+=prefex[idx];
					k=max(k,idx);
				}
		}

		cout<< k<<endl;

	}

/*
*/
return 0;
}


/*|In The Name of Allah|*/
/* Dear GCC compiler:
*
* If my code doesn't compile, this doesn't mean it's wrong.
* It just mean that you don't understand what I want.
* Here's my safety pig, I hope my code compile and get accepted.
* _._ _..._ .-',     _.._(`))
*'-. `     '  /-._.-'    ',/
*   )         \            '.
*  / _    _    |             \
* |  a    a    /              |
* \   .-.                     ;
*  '-('' ).-'       ,'       ;
*     '-;           |      .'
*        \           \    /
*        | 7  .__  _.-\   \
*        | |  |  ``/  /`  /
*       /,_|  |   /,_/   /
*          /,_/      '`-'
*/
#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y){
if (y == 0)
	return 1;
long long ret = power(x , y >> 1) %1000000007 ;
if (y % 2 == 0)
	return (ret * ret) % 1000000007;
else
	return (x * (ret * ret % 1000000007)) % 1000000007;
}

pair<int, int> norm(pair<int, int> p)
{
	if(p.first < 0)
	{
		p.first *= -1;
		p.second *= -1;
	}
	else if (p.first == 0 && p.second < 0)
	{
		p.second *= -1;
	}
	int d = __gcd(abs(p.first), abs(p.second));
	p.first /= d;
	p.second /= d;
	return p;
}

/*

int parent[N], sz[N];
int n, m, components;

void init(){
  iota(parent, parent+n, 0);
  fill(sz, sz+n, 1);
  components = n;
}

int find(int u){
  if(parent[u] == u)  return u;
  return parent[u] = find(parent[u]);
}

void join(int u, int v){
  u = find(u), v = find(v);
  if(u == v)  return;
  if(sz[u] < sz[v]) swap(u, v);
  parent[v] = u;
  sz[u] += sz[v];
  --components;
}
int dst[N];
int vis[N];
int parent[N];
vector<vector<pair<int,ll>>>v(N);
void dikstra(){
	set<pair<ll,ll>>s;
	clr(dst,oo);
	clr(vis,0);
	clr(parent,-1);
	dst[1]=0;
	parent[1]=-1;
	s.insert( mp(0,1 ) );
	while(!s.empty()){

		pair<ll,ll> x=*s.begin();
		s.erase(s.begin());
		ll u=x.sc;
		ll d=x.fr;
		if (vis[u])continue;
		vis[u]=1;
		for (int i=0;i<v[u].size();i++){
			ll to=v[u][i].fr;
			ll cost=v[u][i].sc;
			if (vis[to]||d+cost>=dst[to])continue;
			dst[to]=d+cost;
			parent[to]=u;
			s.insert(mp(d+cost,to));
		}
	}

return;
}
void primeFactors(int n)
{
    while (n % 2 == 0){
        n = n/2;
    }

    for (int i = 3; i <= sqrt(n); i = i + 2)
    {
        while (n % i == 0){
            cout << i << " ";
            n = n/i;
        }
    }
    if (n > 2){

    }
}

void Theaf(){
isPrime[0]=1;
isPrime[1]=1;
for (int i=2;i*i<=N;i++){
	if (isPrime[i]==1)continue;
	for (int cnt=2;i*cnt<=N;cnt++)isPrime[ cnt*i ]=1;
}

}
void dfs_EdgeClassification(int node)
{
	start[node] = timer++;

	rep(i, adj[node])
	{
		int child = adj[node][i];
		if (start[child] == -1)	// Not visited Before. Treed Edge
			dfs_EdgeClassification(child);
		else {
			if(finish[child] == -1)// then this is ancestor that called us and waiting us to finish. Then Cycle. Back Edge
				anyCycle = 1;
			else if(start[node] < start[child])	// then you are my descendant
				;	// Forward Edge
			else
				;	// Cross Edge
		}
	}

	finish[node] = timer++;
}

vectorll factorization(ll n) 	 max n is 1e12
{	// O( sqrt(n) )

	vectorll primes;

	for (ll i = 2; i  i * i <= n; ++i)	 Improve start by i = 3.
		while (n % i == 0)
			primes.push_back(i), n /= i;	 Get every prime inside n.	n  i^j	is a new number

	 Two ways to prove that n will be prime number if n  1
	 1) Think in n  pi^x as a NEW sub-problem. If we went to its sqrt and % applied, then we are facing a prime number
	 2) Prove that, for any n either all its primes before sqrt(n), or only the biggest prime after sqrt(n).
	if (n  > 1)
		primes.push_back(n);

	return primes;
}
int mod(string num, int a)
{
    // Initialize result
    int res = 0;

    // One by one process all digits of 'num'
    for (int i = 0; i < num.length(); i++)
         res = (res*10 + (int)num[i] - '0') %a;

    return res;
}

struct uf{
	static const int MAXN=105;
	int par[MAXN];
	int size[MAXN];
	void init(){
		memset(par,-1,sizeof(par));
		REP(i,MAXN) size[i]=1;
	}
	int root(int a){
		if(par[a]==-1) return a;
		return par[a]=root(par[a]);
	}
	void unite(int a,int b){
		a=root(a);b=root(b);
		if(a==b) return;
		if(size[a]<size[b]) swap(a,b);

		par[b]=a;
		size[a]+=size[b];
	}
	bool same(int a,int b){
		return root(a)==root(b);
	}
};
uf u_[105];
int mood(string num, int a)
{
    // Initialize result
    int res = 0;

    // One by one process all digits of 'num'
    for (int i = 0; i < (int)num.length(); i++)
         res = (res*10 + (int)num[i] - '0') %a;

    return res;
}

*/
const double Eps =(1e-7);
int dcmp(double x,double y){ return fabs(x-y)<=Eps? 0: x<y ?-1:1; }

typedef long long  ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<pair<int,int> > vii;
typedef map<int, int> mii;
typedef map<string, int> msi;
typedef pair<int, int> pii;
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define sll set <ll>
#define spii set <pii>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1,v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1,v2,v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define el	'\n'
#define lp(i,n) for(int i = 0;i < int(n);i++)
#define lp1(i,n) for(int i = 1;i <= int(n);i++)
#define rlp(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rng(i,a,b) for(int i = int(a);i <= int(b);i++)
#define mp(x,y)  	make_pair((x),(y))
#define pb(x)    	push_back((x))
#define all(v)  	((v).begin()),((v).end())
#define sz(x)  		((int) (x).size())
#define bits(a) 	__builtin_popcountll(a)
#define fr first
#define sc second
#define pii pair<int, int>
#define sortva(v) sort(all(v))
#define sortvd(v) sort(v.rbegin(),v.rend())
#define sortaa(a,n) sort(a,a+n)
#define sortad(a,n) sort(a,a+n),reverse(a,a+n)
#define SS stringstream
#define ll long long
#define clr(x, y) memset(x, y, sizeof(x))
#define foreach(it,x) for(__typeof__((x).begin()) it = (x).begin(); it != (x).end(); ++it)
#define read freopen("input.in", "rt", stdin);
#define write freopen("output.in", "wt", stdout);
#define fastIO cout << fixed << setprecision(0), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
int kx[] = { 2, 2, 1, -1, -2, -2, 1, -1 };
int ky[] = { 1, -1, 2, 2, 1, -1, -2, -2 };
ll gcd(ll a, ll b){if (a == 0)return b;return gcd(b % a, a);}
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }

ll const N =(int)5e5+9, mod = 100000000 , oo = 1e9+7;

//------------------------------------------------------------------------------------

ll t,n;
ll arr[N];
ll prefex[N];
int main()
{
	cin>>t;
	lp1(i,35)prefex[i]=((ll)1<<(i-1));
	lp1(i,35)prefex[i]=prefex[i-1]+prefex[i];

	while(t--){
		cin>>n;
		ll k=0;
		lp1(i,n)cin>>arr[i];
		for (int i=2;i<=n;i++){
			if (arr[i]>=arr[i-1]);
				else {
					ll x=arr[i-1]-arr[i];
					ll idx=lower_bound(prefex,prefex+33,x)-prefex;
					if (idx<=prefex[k])arr[i]+=prefex[idx];
					else {
						k=idx;
						arr[i]+=prefex[k];
					}
				}
		}

		cout<< k<<endl;

	}

/*
*/

return 0;
}


/*|In The Name of Allah|*/
/* Dear GCC compiler:
*
* If my code doesn't compile, this doesn't mean it's wrong.
* It just mean that you don't understand what I want.
* Here's my safety pig, I hope my code compile and get accepted.
* _._ _..._ .-',     _.._(`))
*'-. `     '  /-._.-'    ',/
*   )         \            '.
*  / _    _    |             \
* |  a    a    /              |
* \   .-.                     ;
*  '-('' ).-'       ,'       ;
*     '-;           |      .'
*        \           \    /
*        | 7  .__  _.-\   \
*        | |  |  ``/  /`  /
*       /,_|  |   /,_/   /
*          /,_/      '`-'
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

using namespace std;
using namespace  __gnu_pbds;
long long  mood=1e14;

long long power(long long x, long long y,long long mood){
if (y == 0)
	return 1;
long long ret = power(x , y >> 1,mood) %mood ;
if (y % 2 == 0)
	return (ret * ret) % mood;
else
	return (x * (ret * ret % mood)) % mood;
}

pair<int, int> norm(pair<int, int> p)
{
	if(p.first < 0)
	{
		p.first *= -1;
		p.second *= -1;
	}
	else if (p.first == 0 && p.second < 0)
	{
		p.second *= -1;
	}
	int d = __gcd(abs(p.first), abs(p.second));
	p.first /= d;
	p.second /= d;
	return p;
}

/*

int parent[N], sz[N];
int n, m, components;

void init(){
  iota(parent, parent+N, 0);
  fill(sz, sz+N, 1);
  components = N;
}

int find(int u){
  if(parent[u] == u)  return u;
  return parent[u] = find(parent[u]);
}

void join(int u, int v){
  u = find(u), v = find(v);
  if(u == v)  return;
  if(sz[u] < sz[v]) swap(u, v);
  parent[v] = u;
  sz[u] += sz[v];
  --components;
}
int dst[N];
int vis[N];
int parent[N];
vector<vector<pair<int,ll>>>v(N);
void dikstra(){
	set<pair<ll,ll>>s;
	clr(dst,oo);
	clr(vis,0);
	clr(parent,-1);
	dst[1]=0;
	parent[1]=-1;
	s.insert( mp(0,1 ) );
	while(!s.empty()){

		pair<ll,ll> x=*s.begin();
		s.erase(s.begin());
		ll u=x.sc;
		ll d=x.fr;
		if (vis[u])continue;
		vis[u]=1;
		for (int i=0;i<v[u].size();i++){
			ll to=v[u][i].fr;
			ll cost=v[u][i].sc;
			if (vis[to]||d+cost>=dst[to])continue;
			dst[to]=d+cost;
			parent[to]=u;
			s.insert(mp(d+cost,to));
		}
	}

return;
}
void primeFactors(int n)
{
	while (n % 2 == 0){
		n = n/2;
	}

	for (int i = 3; i <= sqrt(n); i = i + 2)
	{
		while (n % i == 0){
			cout << i << " ";
			n = n/i;
		}
	}
	if (n > 2){

	}
}

void Theaf(){
isPrime[0]=1;
isPrime[1]=1;
for (int i=2;i*i<=N;i++){
	if (isPrime[i]==1)continue;
	for (int cnt=2;i*cnt<=N;cnt++)isPrime[ cnt*i ]=1;
}

}
void dfs_EdgeClassification(int node)
{
	start[node] = timer++;

	rep(i, adj[node])
	{
		int child = adj[node][i];
		if (start[child] == -1)	// Not visited Before. Treed Edge
			dfs_EdgeClassification(child);
		else {
			if(finish[child] == -1)// then this is ancestor that called us and waiting us to finish. Then Cycle. Back Edge
				anyCycle = 1;
			else if(start[node] < start[child])	// then you are my descendant
				;	// Forward Edge
			else
				;	// Cross Edge
		}
	}

	finish[node] = timer++;
}

vectorll factorization(ll n) 	 max n is 1e12
{	// O( sqrt(n) )

	vectorll primes;

	for (ll i = 2; i  i * i <= n; ++i)	 Improve start by i = 3.
		while (n % i == 0)
			primes.push_back(i), n /= i;	 Get every prime inside n.	n  i^j	is a new number

	 Two ways to prove that n will be prime number if n  1
	 1) Think in n  pi^x as a NEW sub-problem. If we went to its sqrt and % applied, then we are facing a prime number
	 2) Prove that, for any n either all its primes before sqrt(n), or only the biggest prime after sqrt(n).
	if (n  > 1)
		primes.push_back(n);

	return primes;
}

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

	ordered_set X;
	X.insert(1);
	X.insert(2);
	X.insert(4);
	X.insert(8);
	X.insert(16);

	0 1 2 3 4
	1 2 4 8 16
	cout<<*X.find_by_order(1)<<endl; // 2
	cout<<*X.find_by_order(2)<<endl; // 4
	cout<<*X.find_by_order(4)<<endl; // 16
	cout<<(end(X)==X.find_by_order(6))<<endl; // true

	cout<<X.order_of_key(-5)<<endl;  // 0
	cout<<X.order_of_key(1)<<endl;   // 0
	cout<<X.order_of_key(3)<<endl;   // 2
	cout<<X.order_of_key(4)<<endl;   // 2
	cout<<X.order_of_key(400)<<endl; // 5

int t = 0;

ordered_set me;
...
me.insert({x, t++});
me.erase(me.lower_bound({x, 0}));
cout << me.order_of_key({x, 0}) << "\n";

*/
const double Eps =(1e-7);
int dcmp(double x,double y){ return fabs(x-y)<=Eps? 0: x<y ?-1:1; }
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_setpair;
typedef long long  ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<pair<int,int> > vii;
typedef map<int, int> mii;
typedef map<string, int> msi;
typedef pair<int, int> pii;
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define sll set <ll>
#define spii set <pii>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1,v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1,v2,v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define el	'\n'
#define lp(i,n) for(int i = 0;i < int(n);i++)
#define lp1(i,n) for(int i = 1;i <= int(n);i++)
#define rlp(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rng(i,a,b) for(int i = int(a);i <= int(b);i++)
#define mp(x,y)  	make_pair((x),(y))
#define pb(x)    	push_back((x))
#define all(v)  	((v).begin()),((v).end())
#define sz(x)  		((int) (x).size())
#define bits(a) 	__builtin_popcountll(a)
#define fr first
#define sc second
#define pii pair<int, int>
#define sortva(v) sort(all(v))
#define sortvd(v) sort(v.rbegin(),v.rend())
#define sortaa(a,n) sort(a,a+n)
#define sortad(a,n) sort(a,a+n),reverse(a,a+n)
#define SS stringstream
#define ll long long
#define clr(x, y) memset(x, y, sizeof(x))
#define foreach(it,x) for(__typeof__((x).begin()) it = (x).begin(); it != (x).end(); ++it)
#define read freopen("input.in", "rt", stdin);
#define write freopen("output.in", "wt", stdout);
#define fastIO cout << fixed << setprecision(0), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
const long long  P = (31);
const long long  key2 = 59;
int dx[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
int dy[] = { 1, 0, -1, 0, -1, 1, 1, -1 };
int kx[] = { 2, 2, 1, -1, -2, -2, 1, -1 };
int ky[] = { 1, -1, 2, 2, 1, -1, -2, -2 };
ll gcd(ll a, ll b){if (a == 0)return b;return gcd(b % a, a);}
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }

int const N = 5e5+9, mod = 1e9+7 ,  oo = 1e9+7;

//------------------------------------------------------------------------------------

ll t,n;
ll arr[N];
ll prefex[N];
int main()
{
	cin>>t;
	lp1(i,37)prefex[i]=((ll)1<<(i-1));
	lp1(i,37)prefex[i]=prefex[i-1]+prefex[i];

	while(t--){
		cin>>n;
		ll k=0;
		lp1(i,n)cin>>arr[i];
		for (int i=2;i<=n;i++){
			if (arr[i]>=arr[i-1]);
				else {
					ll x=arr[i-1]-arr[i];
					ll idx=lower_bound(prefex,prefex+35,x)-prefex;
					arr[i]+=prefex[idx];
					k=max(k,idx);
				}
		}

		cout<< k<<endl;

	}

/*
*/
return 0;
}


/*|In The Name of Allah|*/
/* Dear GCC compiler:
*
* If my code doesn't compile, this doesn't mean it's wrong.
* It just mean that you don't understand what I want.
* Here's my safety pig, I hope my code compile and get accepted.
* _._ _..._ .-',     _.._(`))
*'-. `     '  /-._.-'    ',/
*   )         \            '.
*  / _    _    |             \
* |  a    a    /              |
* \   .-.                     ;
*  '-('' ).-'       ,'       ;
*     '-;           |      .'
*        \           \    /
*        | 7  .__  _.-\   \
*        | |  |  ``/  /`  /
*       /,_|  |   /,_/   /
*          /,_/      '`-'
*/
#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y){
if (y == 0)
	return 1;
long long ret = power(x , y >> 1) %1000000007 ;
if (y % 2 == 0)
	return (ret * ret) % 1000000007;
else
	return (x * (ret * ret % 1000000007)) % 1000000007;
}

pair<int, int> norm(pair<int, int> p)
{
	if(p.first < 0)
	{
		p.first *= -1;
		p.second *= -1;
	}
	else if (p.first == 0 && p.second < 0)
	{
		p.second *= -1;
	}
	int d = __gcd(abs(p.first), abs(p.second));
	p.first /= d;
	p.second /= d;
	return p;
}

/*

int parent[N], sz[N];
int n, m, components;

void init(){
  iota(parent, parent+n, 0);
  fill(sz, sz+n, 1);
  components = n;
}

int find(int u){
  if(parent[u] == u)  return u;
  return parent[u] = find(parent[u]);
}

void join(int u, int v){
  u = find(u), v = find(v);
  if(u == v)  return;
  if(sz[u] < sz[v]) swap(u, v);
  parent[v] = u;
  sz[u] += sz[v];
  --components;
}
int dst[N];
int vis[N];
int parent[N];
vector<vector<pair<int,ll>>>v(N);
void dikstra(){
	set<pair<ll,ll>>s;
	clr(dst,oo);
	clr(vis,0);
	clr(parent,-1);
	dst[1]=0;
	parent[1]=-1;
	s.insert( mp(0,1 ) );
	while(!s.empty()){

		pair<ll,ll> x=*s.begin();
		s.erase(s.begin());
		ll u=x.sc;
		ll d=x.fr;
		if (vis[u])continue;
		vis[u]=1;
		for (int i=0;i<v[u].size();i++){
			ll to=v[u][i].fr;
			ll cost=v[u][i].sc;
			if (vis[to]||d+cost>=dst[to])continue;
			dst[to]=d+cost;
			parent[to]=u;
			s.insert(mp(d+cost,to));
		}
	}

return;
}
void primeFactors(int n)
{
    while (n % 2 == 0){
        n = n/2;
    }

    for (int i = 3; i <= sqrt(n); i = i + 2)
    {
        while (n % i == 0){
            cout << i << " ";
            n = n/i;
        }
    }
    if (n > 2){

    }
}

void Theaf(){
isPrime[0]=1;
isPrime[1]=1;
for (int i=2;i*i<=N;i++){
	if (isPrime[i]==1)continue;
	for (int cnt=2;i*cnt<=N;cnt++)isPrime[ cnt*i ]=1;
}

}
void dfs_EdgeClassification(int node)
{
	start[node] = timer++;

	rep(i, adj[node])
	{
		int child = adj[node][i];
		if (start[child] == -1)	// Not visited Before. Treed Edge
			dfs_EdgeClassification(child);
		else {
			if(finish[child] == -1)// then this is ancestor that called us and waiting us to finish. Then Cycle. Back Edge
				anyCycle = 1;
			else if(start[node] < start[child])	// then you are my descendant
				;	// Forward Edge
			else
				;	// Cross Edge
		}
	}

	finish[node] = timer++;
}

vectorll factorization(ll n) 	 max n is 1e12
{	// O( sqrt(n) )

	vectorll primes;

	for (ll i = 2; i  i * i <= n; ++i)	 Improve start by i = 3.
		while (n % i == 0)
			primes.push_back(i), n /= i;	 Get every prime inside n.	n  i^j	is a new number

	 Two ways to prove that n will be prime number if n  1
	 1) Think in n  pi^x as a NEW sub-problem. If we went to its sqrt and % applied, then we are facing a prime number
	 2) Prove that, for any n either all its primes before sqrt(n), or only the biggest prime after sqrt(n).
	if (n  > 1)
		primes.push_back(n);

	return primes;
}
int mod(string num, int a)
{
    // Initialize result
    int res = 0;

    // One by one process all digits of 'num'
    for (int i = 0; i < num.length(); i++)
         res = (res*10 + (int)num[i] - '0') %a;

    return res;
}

struct uf{
	static const int MAXN=105;
	int par[MAXN];
	int size[MAXN];
	void init(){
		memset(par,-1,sizeof(par));
		REP(i,MAXN) size[i]=1;
	}
	int root(int a){
		if(par[a]==-1) return a;
		return par[a]=root(par[a]);
	}
	void unite(int a,int b){
		a=root(a);b=root(b);
		if(a==b) return;
		if(size[a]<size[b]) swap(a,b);

		par[b]=a;
		size[a]+=size[b];
	}
	bool same(int a,int b){
		return root(a)==root(b);
	}
};
uf u_[105];
int mood(string num, int a)
{
    // Initialize result
    int res = 0;

    // One by one process all digits of 'num'
    for (int i = 0; i < (int)num.length(); i++)
         res = (res*10 + (int)num[i] - '0') %a;

    return res;
}

*/
const double Eps =(1e-7);
int dcmp(double x,double y){ return fabs(x-y)<=Eps? 0: x<y ?-1:1; }

typedef long long  ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<pair<int,int> > vii;
typedef map<int, int> mii;
typedef map<string, int> msi;
typedef pair<int, int> pii;
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define sll set <ll>
#define spii set <pii>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1,v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1,v2,v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define el	'\n'
#define lp(i,n) for(int i = 0;i < int(n);i++)
#define lp1(i,n) for(int i = 1;i <= int(n);i++)
#define rlp(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rng(i,a,b) for(int i = int(a);i <= int(b);i++)
#define mp(x,y)  	make_pair((x),(y))
#define pb(x)    	push_back((x))
#define all(v)  	((v).begin()),((v).end())
#define sz(x)  		((int) (x).size())
#define bits(a) 	__builtin_popcountll(a)
#define fr first
#define sc second
#define pii pair<int, int>
#define sortva(v) sort(all(v))
#define sortvd(v) sort(v.rbegin(),v.rend())
#define sortaa(a,n) sort(a,a+n)
#define sortad(a,n) sort(a,a+n),reverse(a,a+n)
#define SS stringstream
#define ll long long
#define clr(x, y) memset(x, y, sizeof(x))
#define foreach(it,x) for(__typeof__((x).begin()) it = (x).begin(); it != (x).end(); ++it)
#define read freopen("input.in", "rt", stdin);
#define write freopen("output.in", "wt", stdout);
#define fastIO cout << fixed << setprecision(0), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
int kx[] = { 2, 2, 1, -1, -2, -2, 1, -1 };
int ky[] = { 1, -1, 2, 2, 1, -1, -2, -2 };
ll gcd(ll a, ll b){if (a == 0)return b;return gcd(b % a, a);}
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }

ll const N =(int)5e5+9, mod = 100000000 , oo = 1e9+7;

//------------------------------------------------------------------------------------

ll t,n;
ll arr[N];
ll prefex[N];
int main()
{
	cin>>t;
	lp1(i,33)prefex[i]=(1<<(i-1));
	lp1(i,33)prefex[i]=prefex[i-1]+prefex[i];

	while(t--){
		cin>>n;
		int k=0;
		lp1(i,n)cin>>arr[i];
		for (int i=2;i<=n;i++){
			if (arr[i]>=arr[i-1]);
				else {
					int x=arr[i-1]-arr[i];
					int idx=lower_bound(prefex,prefex+32,x)-prefex;
					if (idx<=prefex[k])arr[i]+=prefex[idx];
					else {
						k=idx;
						arr[i]+=prefex[k];
					}
				}
		}

		cout<< k<<endl;

	}

/*
*/

return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long int

ll highestPowerof2(ll n)
{
   ll p = (ll)log2(n);
   return (ll)p+1;
}

int main()
{
    ll t;
    cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        long a[100000];
        for(ll i=0;i<n;i++)
        {
            cin>>a[i];
        }
        long x=0;
        long c=0;
        for(ll i=1;i<n;i++)
        {
            if((a[i]+c)<a[i-1])
            {
                long z=a[i-1]-a[i];
               // c=(ll)pow(2,y)
                long y=0;
                while(z!=0)
                    {

                        z/=2;
                        y++;
                    }
                    x=max(y,x);
                    c=pow(2,x-1);
                    a[i]+=c;
                   // cout<<a[i]<<"<---\n";
            }
            else
                a[i]+=x;
        }
        cout<<x<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long int

int main()
{
    ll t;
    cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        long a[100000];
        for(ll i=0;i<n;i++)
        {
            cin>>a[i];
        }
        long x=0;
        long c=0;
        for(ll i=1;i<n;i++)
        {
            if((a[i])<a[i-1])
            {

                while((a[i])<a[i-1])
                    {

                        c++;
                        x=pow(2,c-1);
                        a[i]+=x;
                    }
            }
        }
        cout<<c<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long int

int main()
{
    ll t;
    cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        long a[100000];
        for(ll i=0;i<n;i++)
        {
            cin>>a[i];
        }
        long x=0;
        long c=0;
        for(ll i=1;i<n;i++)
        {
            if((a[i])<a[i-1])
            {

                while((a[i])<a[i-1])
                    {

                        c++;
                        x=pow(2,c-1);
                        a[i]+=x;
                    }
            }
            else
        }
        cout<<c<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long int

ll check(ll n)
{
    ll x=0;
   while(n!=0)
   {
       n/=2;
       x++;
   }
   return x;
}

int main()
{
    ll t;
    cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        long a[100000];
        for(ll i=0;i<n;i++)
        {
            cin>>a[i];
        }
        long maximum=a[0],m=0;;
        for(long i=1;i<n;i++)
        {
            if(a[i]<maximum)
            {
                long d=check(a[i]-maximum);
                m=max(d,m);
            }
            else
                maximum=a[i];
        }
        cout<<m<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;

int main()
{
    int t;
    cin>>t;
    while(t--)  {
        int n;
        cin>>n;
        ll A[n];
        for(int i=0; i<n; i++)  {
            cin>>A[i];
        }
        ll Dp[n];
        Dp[0]=0;
        for(int i=1; i<n; i++)  {
            if(A[i]>=A[i-1])  {
                Dp[i]=Dp[i-1];
            }
            else  {
                int j=Dp[i-1];
                int a=j;
                ll temp=A[i-1]-A[i];
                if(j==0)
                  j++;
                ll fake=(ll)pow(2,j)-1;
                while(fake<temp)  {
                    j++;
                    fake+=(ll)pow(2,j);
                }
                if(a==0 && A[i-1]-A[i]==1)
                   j--;
                Dp[i]=j+1;
            }
        }
        cout<<Dp[n-1]<<endl;
    }

   return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;

int main()
{
   int t;
   cin>>t;
   while(t--)  {
       int n;
       cin>>n;
       ll A[n];
       bool B[n]={false};
       cin>>A[0];
       ll cnt=0;
       ll a;
       for(int i=1; i<n; i++)  {
           cin>>A[i];
           if(A[i]<A[i-1])  {
               a=cnt;
               if(A[i-1]-A[i]==1 && a!=0)  {
                   continue;
               }
               ll temp=(ll)pow(2,++cnt)-1;
               while(temp<A[i-1]-A[i])  {
                   temp=(ll)pow(2,++cnt)-1;
               }
               if(a!=0 && temp==A[i-1]-A[i])  {
                   ++cnt;
               }
           }
       }
       cout<<cnt<<endl;
   }
   return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;

int main()
{
    int t;
    cin>>t;
    while(t--)  {
        int n;
        cin>>n;
        ll A[n];
        for(int i=0; i<n; i++)  {
            cin>>A[i];
        }
        ll Dp[n];
        Dp[0]=0;
        for(int i=1; i<n; i++)  {
            if(A[i]>=A[i-1])  {
                Dp[i]=Dp[i-1];
            }
            else  {
                Dp[i]=max(Dp[i-1],(ll)log2(A[i-1]-A[i]+1)+1);
            }
        }
        cout<<Dp[n-1]<<endl;
    }

   return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;

int main()
{
   int t;
   cin>>t;
   while(t--)  {
       int n;
       cin>>n;
       ll A[n];
       bool B[n]={false};
       cin>>A[0];
       ll cnt=0;
       ll a;
       for(int i=1; i<n; i++)  {
           cin>>A[i];
           if(A[i]<A[i-1])  {
               a=cnt;
               ll temp=(ll)pow(2,++cnt)-1;
               while(temp<A[i-1]-A[i])  {
                   temp=(ll)pow(2,++cnt)-1;
               }
               if(a!=0 && temp==A[i-1]-A[i])  {
                   ++cnt;
               }
               if(A[i]+pow(2,cnt-1)>=A[i-1])  {
                   A[i]+=pow(2,cnt-1);
               }
               else  {
                   A[i]+=pow(2,cnt)-1;
               }
           }
       }
       cout<<cnt<<endl;
   }
   return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
        ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	long long int t,n;
	cin>>t;
	for(int k=0;k<t;k++)
	{
		cin>>n;
		long long int A[n],diff=0;
		for(int k=0;k<n;k++)
		{
			cin>>A[k];
		}
		long long int m=A[0];
		for(int i=1;i<n;i++)
		{
			diff=max(m-A[i],diff);
			m=max(m,A[i]);
		}
		cout << (ceil)(log2(diff+1)) << endl;
	}

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
typedef long double ld;
#define vi vector<int>
#define vpii vector<pair<int,int>>
const int mod = 1000000007;

void solve(){
    int n;
    cin>>n;
    int a[n];
    int val=0;
    int ma=INT_MIN;
    ll s=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        ma=max(ma,a[i]);
        val=max(val,ma-a[i]);
    }
    while((1<<s)-1<val)
    {
        s++;
    }
    cout<<s<<endl;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
    int tt;
    cin>>tt;
    while(tt--)
    solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
typedef long double ld;
#define vi vector<int>
#define vpii vector<pair<int,int>>
const int mod = 1000000007;

void solve(){
   int n;
   cin>>n;
   int a[n];
   int mi=INT_MAX;
   int k=0;
   int l=1;
   for(int i=0;i<n;i++)
   {
   	cin>>a[i];
   	mi=min(mi,a[i]);
   	if(mi==a[i])
   	{
   		k=i;
   	}
   	if(i!=0&&a[i]>=a[i-1])
   	{
   		l++;
   	}
   }
   if(l==n)
   {
   	cout<<"0"<<endl;
   	return;
   }
   int ans=0;
   for(int i=1;i<n;i++)
   {
   	if(a[i]>=a[i-1])continue;
   	int y=abs(a[i]-a[i-1]);
   	int u=ceil(log2(y));
   	ans=max(ans,u+1);
   	a[i]+=pow(2,u);
   }
   cout<<ans<<endl;

}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
//     #ifndef ONLINE_JUDGE
//     // for getting input from input.txt
//     freopen("input.txt", "r", stdin);
//     // for writing output to output.txt
//     freopen("putput.txt", "w", stdout);
// 	#endif
    int tt;
    cin>>tt;
    while(tt--)
    solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
typedef long double ld;
#define vi vector<int>
#define vpii vector<pair<int,int>>
const int mod = 1000000007;

void solve(){
    int n;
    cin>>n;
    int a[n];
    int val=0;
    int ma=INT_MIN;
    ll s=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        ma=max(ma,a[i]);
        val=max(val,ma-a[i]);
    }
    while((1<<s)<val)
    {
        s++;
    }
    cout<<s+1<<endl;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
    int tt;
    cin>>tt;
    while(tt--)
    solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
typedef long double ld;
#define vi vector<int>
#define vpii vector<pair<int,int>>
const int mod = 1000000007;

void solve(){
    int n;
    cin>>n;
    int a[n];
    int val=0;
    int ma=INT_MIN;
    ll s=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        ma=max(ma,a[i]);
        val=max(val,ma-a[i]);
    }
    while((1LL<<s)<=val)
    {
        s++;
    }
    cout<<s<<endl;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
    int tt;
    cin>>tt;
    while(tt--)
    solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
typedef long double ld;
#define vi vector<int>
#define vpii vector<pair<int,int>>
const int mod = 1000000007;

void solve(){
    int n;
    cin>>n;
    int a[n];
    int val=0;
    int ma=INT_MIN;
    ll s=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        ma=max(ma,a[i]);
        val=max(val,ma-a[i]);
    }
    while((1LL<<s)-1<val)
    {
        s++;
    }
    cout<<s<<endl;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
    int tt;
    cin>>tt;
    while(tt--)
    solve();
    return 0;
}


/* Author : Mohd Athar */
#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int tt;
    cin>>tt;

    while(tt--){
        int n;
        cin>>n;

        int64_t a[n];
        vector<int64_t>v;
        bool flag = 0;
        int64_t prev = INT_MIN;
        for(int i = 0 ; i<n ; i++){
            cin>>a[i];
            if(a[i] < prev){
                flag = 1;

            }
            prev = a[i];

        }

        if(flag == 0){
            cout<<"0"<<"\n";
            continue;
        }

        int i = 1;
        for( ; i<n ; i++){
            if(a[i] < a[i-1])
                break;
        }

        int64_t maxi = a[i-1];

        for(; i<n ; i++)
            v.emplace_back(a[i]);

        int64_t time = 1;
        int64_t curr = (1<<time) - 1;

        for(auto temp : v){
            maxi = max(maxi , temp);

            if(maxi > curr + temp){
                if(maxi == 0){
                    temp = abs(temp);
                    time = log2(temp);
                    temp = -temp;
                }
                else{

                    time = log2(maxi);
                }

                curr = 1<<time - 1;

                if(temp + curr < maxi){

                  while(temp + curr < maxi){
                    time++;
                    curr = (1<<time) - 1;
                  }
                }
                maxi = max(curr + temp , maxi);

            }

        }

        cout<<time<<"\n";

    }

    return 0;
}


/* Author : Mohd Athar */
#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int tt;
    cin>>tt;

    while(tt--){
        int n;
        cin>>n;

        int64_t a[n];

        bool flag = 0;
        int64_t prev = INT_MIN;
        for(int i = 0 ; i<n ; i++){
            cin>>a[i];
            if(a[i] < prev){
                flag = 1;

            }
            prev = a[i];

        }

        if(flag == 0){
            cout<<"0"<<"\n";
            continue;
        }

        int64_t res = 0;
        int64_t maxi = LLONG_MIN;
       for(int i = 0 ; i<n ; i++){
            maxi = max(maxi , a[i]);

            res = max(res , maxi - a[i]);
       }

       int64_t time = 0;
       while((int64_t)((1LL<<(time)) - 1) < res)
        time++;

    cout<<time<<"\n";

    }

    return 0;
}


/* Author : Mohd Athar */
#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int tt;
    cin>>tt;

    while(tt--){
        int n;
        cin>>n;

        int64_t a[n];
        vector<int64_t>v;
        bool flag = 0;
        int64_t prev = INT_MIN;
        for(int i = 0 ; i<n ; i++){
            cin>>a[i];
            if(a[i] < prev){
                flag = 1;

            }
            prev = a[i];

        }

        if(flag == 0){
            cout<<"0"<<"\n";
            continue;
        }

        int i = 1;
        for( ; i<n ; i++){
            if(a[i] < a[i-1])
                break;
        }

        int64_t maxi = a[i-1];

        for(; i<n ; i++)
            v.emplace_back(a[i]);

        int64_t time = 1;
        int64_t curr = (1<<time) - 1;

        for(auto temp : v){
            maxi = max(maxi , temp);

            if(maxi > curr + temp){
                if(maxi == 0){
                    temp = abs(temp);
                    time = log2(temp);
                    temp = -temp;
                }
                else{

                    time = log2(maxi);
                }

                curr = 1<<time - 1;

                if(temp + curr < maxi)
                    time++;

                curr = 1<<time -1 ;

            }
            maxi = max(curr + temp , maxi);

        }

        cout<<time<<"\n";

    }

    return 0;
}


/* Author : Mohd Athar */
#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int tt;
    cin>>tt;

    while(tt--){
        int n;
        cin>>n;

        int64_t a[n];

        bool flag = 0;
        int64_t prev = INT_MIN;
        for(int i = 0 ; i<n ; i++){
            cin>>a[i];
            if(a[i] < prev){
                flag = 1;

            }
            prev = a[i];

        }

        if(flag == 0){
            cout<<"0"<<"\n";
            continue;
        }

        int64_t res = 0;
        int64_t maxi = INT_MIN;
       for(int i = 0 ; i<n ; i++){
            maxi = max(maxi , a[i]);

            res = max(res , maxi - a[i]);
       }

       int64_t time = 1;
       while((int64_t)1<<(time-1) < res)
        time++;

    cout<<time<<"\n";

    }

    return 0;
}


/* Author : Mohd Athar */
#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int tt;
    cin>>tt;

    while(tt--){
        int n;
        cin>>n;

        int64_t a[n];
        vector<int64_t>v;
        bool flag = 0;
        int64_t prev = INT_MIN;
        for(int i = 0 ; i<n ; i++){
            cin>>a[i];
            if(a[i] < prev){
                flag = 1;

            }
            prev = a[i];

        }

        if(flag == 0){
            cout<<"0"<<"\n";
            continue;
        }

        int i = 1;
        for( ; i<n ; i++){
            if(a[i] < a[i-1])
                break;
        }

        int64_t maxi = a[i-1];

        for(; i<n ; i++)
            v.emplace_back(a[i]);

        int64_t time = 1;
        int64_t curr = (1<<time - 1);
        for(auto temp : v){
            maxi = max(maxi , temp);

            if(maxi > curr + temp){

                while(curr + temp < maxi){
                    time++;
                    curr = (1<<time - 1);
                }

            }
            maxi = max(curr + temp , maxi);

        }

        cout<<time<<"\n";

    }

    return 0;
}


/* Author : Mohd Athar */
#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int tt;
    cin>>tt;

    while(tt--){
        int n;
        cin>>n;

        int64_t a[n];

        bool flag = 0;
        int64_t prev = INT_MIN;
        for(int i = 0 ; i<n ; i++){
            cin>>a[i];
            if(a[i] < prev){
                flag = 1;

            }
            prev = a[i];

        }

        if(flag == 0){
            cout<<"0"<<"\n";
            continue;
        }

        int64_t res = 0;
        int64_t maxi = INT_MIN;
       for(int i = 0 ; i<n ; i++){
            maxi = max(maxi , a[i]);

            res = max(res , maxi - a[i]);
       }

       int64_t time = 1;
       while(1<<(time-1) < res)
        time++;

    cout<<time<<"\n";

    }

    return 0;
}


#include<bits/stdc++.h>

void solve(){
	long n;
	std::cin>>n;
	long long input[n];
	for(long i=0;i<n;i++){
		std::cin>>input[i];
	}
	long long times = 0;
	for(long i=1;i<n;i++){
		long long time = 0;
		long long val = 1;
		while(input[i] < input[i-1]){
			input[i] += (val<<time);
			time++;
		}
		if(time > times){
			times = time;
		}
	}
	std::cout<<times;
}

int main(){
	long t;
	std::cin>>t;
	while(t--){
		solve();
		std::cout<<"\n";
	}
}


#include<bits/stdc++.h>

long long pos(long long val){
	long long length = 0;
	while(val){
		val /= 2;
		length++;
	}
	return length;
}

void solve(){
	long n;
	std::cin>>n;
	long long input[n];
	for(long i=0;i<n;i++){
		std::cin>>input[i];
	}
	long long times = 0;
	for(long i=1;i<n;i++){
		long long time = 0;
		long long val = input[i] - input[i-1];
		if(val < 0){
			time = pos(val);
			input[i] = input[i-1];
		}
		if(time > times){
			times = time;
		}
	}
	std::cout<<times;
}

int main(){
	long t;
	std::cin>>t;
	while(t--){
		solve();
		std::cout<<"\n";
	}
}


#include<bits/stdc++.h>

void solve(){
	long n;
	std::cin>>n;
	long input[n];
	for(int i=0;i<n;i++){
		std::cin>>input[i];
	}
	long times = 0;
	for(int i=1;i<n;i++){
		long time = 0;
		while(input[i] < input[i-1]){
			input[i] += (1<<time);
			time++;
		}
		if(time > times){
			times = time;
		}
	}
	std::cout<<times;
}

int main(){
	long t;
	std::cin>>t;
	while(t--){
		solve();
		std::cout<<"\n";
	}
}


#include<bits/stdc++.h>

void solve(){
	long n;
	std::cin>>n;
	long long input[n];
	for(long i=0;i<n;i++){
		std::cin>>input[i];
	}
	long long times = 0;
	for(long i=1;i<n;i++){
		long long time = 0;
		while(input[i] < input[i-1]){
			input[i] += (1<<time);
			time++;
		}
		if(time > times){
			times = time;
		}
	}
	std::cout<<times;
}

int main(){
	long t;
	std::cin>>t;
	while(t--){
		solve();
		std::cout<<"\n";
	}
}


#include<bits/stdc++.h>

void solve(){
	long n;
	std::cin>>n;
	long input[n];
	for(int i=0;i<n;i++){
		std::cin>>input[i];
	}
	int times = 0;
	for(int i=1;i<n;i++){
		int time = 0;
		while(input[i] < input[i-1]){
			input[i] += 1<<time;
			time++;
		}
		if(time > times){
			times = time;
		}
	}
	std::cout<<times;
}

int main(){
	long t;
	std::cin>>t;
	while(t--){
		solve();
		std::cout<<"\n";
	}
}


#include<bits/stdc++.h>

void solve(){
	long n;
	std::cin>>n;
	long input[n];
	for(int i=0;i<n;i++){
		std::cin>>input[i];
	}
	int times = 0;
	for(int i=1;i<n;i++){
		int time = 0;
		while(input[i] < input[i-1]){
			input[i] += (1<<time);
			time++;
		}
		if((time-1) > times){
			times = time;
		}
	}
	std::cout<<times;
}

int main(){
	long t;
	std::cin>>t;
	while(t--){
		solve();
		std::cout<<"\n";
	}
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> ii;
#define db(x) cout<<#x<<" = "<<x<<"\n";
#define fore(i,a,b) for(ll i=a,ggdem=b;i<ggdem;i++)
#define FIN ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define SZ(a) ((ll)(a).size())
#define ALL(a) a.begin(),a.end()
#define mset(a,b) memset(a,b,sizeof(a));
#define pb push_back
#define fst first
#define snd second
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll N=3e5+15;
ll n,a[N];
ll get(ll x) {
  ll cur=1,res=0,add=0;
  while(add<x) {
    add+=cur;
    cur=cur*2;
    res++;
  }
  return res;
}
ll solve() {
  cin>>n;
  fore(i,0,n)cin>>a[i];
  ll add=0,mx=0;
  fore(i,1,n) {
    if(a[i]<a[i-1]) {
      add++;
      mx=max(mx,get(a[i-1]-a[i]));
    }
  }
  return max(add,mx);
}
main() {FIN;
  ll q;cin>>q;
  while(q--)cout<<solve()<<"\n";
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> ii;
#define db(x) cout<<#x<<" = "<<x<<"\n";
#define fore(i,a,b) for(ll i=a,ggdem=b;i<ggdem;i++)
#define FIN ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define SZ(a) ((ll)(a).size())
#define ALL(a) a.begin(),a.end()
#define mset(a,b) memset(a,b,sizeof(a));
#define pb push_back
#define fst first
#define snd second
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll INF=1ll<<59;
ll get(ll x) {
  for(ll i=62;i>=0;i--) {
    if(x&(1ll<<i))return i+1;
  }
  return 0;
}
ll solve() {
  ll n,res=0;
  cin>>n;
  vector<ll>a(n);
  fore(i,0,n)cin>>a[i];
  fore(i,1,n) {
    if(a[i]>=a[i-1])continue;
    res=max(res,get(a[i-1]-a[i]));
    a[i]=a[i-1];
  }
  return res;
}
main() {FIN;
  freopen("outBad","w",stdout);
  ll q;cin>>q;
  while(q--)cout<<solve()<<"\n";
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> ii;
#define db(x) cout<<#x<<" = "<<x<<"\n";
#define fore(i,a,b) for(ll i=a,ggdem=b;i<ggdem;i++)
#define FIN ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define SZ(a) ((ll)(a).size())
#define ALL(a) a.begin(),a.end()
#define mset(a,b) memset(a,b,sizeof(a));
#define pb push_back
#define fst first
#define snd second
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll N=3e5+15;
ll n,a[N];
const ll INF=1ll<<59;
ll solve() {
  cin>>n;
  fore(i,0,n)cin>>a[i];
  vector<ll>v;
  fore(i,1,n)if(a[i]<a[i-1])v.pb(a[i-1]-a[i]);
  sort(ALL(v));
  ll res=0,cur=1;
  for(ll i:v) {
    ll x=i;
    while(cur<x){
      res++;
      if(cur<INF){
        x-=cur;
        cur*=2;
      }
    }
    res++;
    if(cur<INF)cur*=2;
  }
  return res;
}
main() {FIN;
  ll q;cin>>q;
  while(q--)cout<<solve()<<"\n";
}
/*
10 9 8 2
*/


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> ii;
#define db(x) cout<<#x<<" = "<<x<<"\n";
#define fore(i,a,b) for(ll i=a,ggdem=b;i<ggdem;i++)
#define FIN ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define SZ(a) ((ll)(a).size())
#define ALL(a) a.begin(),a.end()
#define mset(a,b) memset(a,b,sizeof(a));
#define pb push_back
#define fst first
#define snd second
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll INF=1ll<<59;
ll get(ll x) {
  for(ll i=62;i>=0;i--) {
    if(x&(1ll<<i))return i+1;
  }
  return 0;
}
ll solve() {
  ll n,res=0;
  cin>>n;
  vector<ll>a(n);
  fore(i,0,n)cin>>a[i];
  fore(i,1,n) {
    if(a[i]>=a[i-1])continue;
    res=max(res,get(a[i-1]-a[i]));
    a[i]=a[i-1];
  }
  return res;
}
main() {FIN;
  ll q;cin>>q;
  while(q--)cout<<solve()<<"\n";
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> ii;
#define db(x) cout<<#x<<" = "<<x<<"\n";
#define fore(i,a,b) for(ll i=a,ggdem=b;i<ggdem;i++)
#define FIN ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define SZ(a) ((ll)(a).size())
#define ALL(a) a.begin(),a.end()
#define mset(a,b) memset(a,b,sizeof(a));
#define pb push_back
#define fst first
#define snd second
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll N=3e5+15;
ll n,a[N];
const ll INF=1ll<<59;
ll solve() {
  cin>>n;
  fore(i,0,n)cin>>a[i];
  vector<ll>v;
  fore(i,1,n)if(a[i]<a[i-1])v.pb(a[i-1]-a[i]);
  sort(ALL(v));
  ll res=0,cur=1;
  for(ll i:v) {
    while(cur<i){
      res++;
      if(cur<INF)cur*=2;
    }
    res++;
    if(cur<INF)cur*=2;
  }
  return res;
}
main() {FIN;
  ll q;cin>>q;
  while(q--)cout<<solve()<<"\n";
}
/*
10 9 8 2
*/


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> ii;
#define db(x) cout<<#x<<" = "<<x<<"\n";
#define fore(i,a,b) for(ll i=a,ggdem=b;i<ggdem;i++)
#define FIN ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define SZ(a) ((ll)(a).size())
#define ALL(a) a.begin(),a.end()
#define mset(a,b) memset(a,b,sizeof(a));
#define pb push_back
#define fst first
#define snd second
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll INF=1ll<<59;
ll n,res;
ll get(ll x) {
  for(ll i=0;true;i++) {
    if((1ll<<i)-1 >= x)return i;
  }
}
void doit(vector<ll> &cur) {
  if(!SZ(cur))return;
  ll l=0,r=0;
  for(ll i=0;i<SZ(cur);i+=2)l=max(l,cur[i]);
  for(ll i=1;i<SZ(cur);i+=2)r=max(r,cur[i]);
  res=max(res,get(max(l,r))+(l==r));
}
ll solve() {
  res=0;
  cin>>n;
  vector<ll>a(n);
  fore(i,0,n)cin>>a[i];
  vector<ll>v;
  fore(i,1,n)v.pb(max(0ll,a[i-1]-a[i]));
  vector<ll>cur;
  for(ll i:v) {
    if(i==0) {
      doit(cur);
      cur.clear();
    } else {
      cur.pb(i);
    }
  }
  doit(cur);
  return res;
}
main() {FIN;
  ll q;cin>>q;
  while(q--)cout<<solve()<<"\n";
}
/*
1
6
10 9 12 11 14 13

1 5 1
5 1 5
1 1 1 1
5 1 5 1 1 5
1 5 5 1
2 5 5 2
4 5 5 3
5 5
4 5 5 3
3 5 4 3
3 0 0 4
5 6 5
*/


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> ii;
#define db(x) cout<<#x<<" = "<<x<<"\n";
#define fore(i,a,b) for(ll i=a,ggdem=b;i<ggdem;i++)
#define FIN ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define SZ(a) ((ll)(a).size())
#define ALL(a) a.begin(),a.end()
#define mset(a,b) memset(a,b,sizeof(a));
#define pb push_back
#define fst first
#define snd second
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll N=3e5+15;
ll n,a[N];
const ll INF=1ll<<60;
ll solve() {
  cin>>n;
  fore(i,0,n)cin>>a[i];
  vector<ll>v;
  fore(i,1,n)if(a[i]<a[i-1])v.pb(a[i-1]-a[i]);
  sort(ALL(v));
  ll res=0,cur=1;
  for(ll i:v) {
    while(cur<i)res++,cur*=2;
    cur*=2,res++;
  }
  return res;
}
main() {FIN;
  ll q;cin>>q;
  while(q--)cout<<solve()<<"\n";
}
/*
10 9 8 2
*/


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> ii;
#define db(x) cout<<#x<<" = "<<x<<"\n";
#define fore(i,a,b) for(ll i=a,ggdem=b;i<ggdem;i++)
#define FIN ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define SZ(a) ((ll)(a).size())
#define ALL(a) a.begin(),a.end()
#define mset(a,b) memset(a,b,sizeof(a));
#define pb push_back
#define fst first
#define snd second
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll N=3e5+15;
ll n,a[N];
ll get(ll x) {
  ll cur=0,res=0;
  while(cur<x) {
    cur=cur*2+1;
    res++;
  }
  return res;
}
ll solve() {
  cin>>n;
  fore(i,0,n)cin>>a[i];
  ll add=0,mx=0;
  fore(i,1,n) {
    if(a[i]<a[i-1]) {
      add++;
      mx=max(mx,get(a[i-1]-a[i]));
    }
  }
  return max(add,mx);
}
main() {FIN;
  ll q;cin>>q;
  while(q--)cout<<solve()<<"\n";
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> ii;
#define db(x) cout<<#x<<" = "<<x<<"\n";
#define fore(i,a,b) for(ll i=a,ggdem=b;i<ggdem;i++)
#define FIN ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define SZ(a) ((ll)(a).size())
#define ALL(a) a.begin(),a.end()
#define mset(a,b) memset(a,b,sizeof(a));
#define pb push_back
#define fst first
#define snd second
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll N=3e5+15;
ll n,a[N];
const ll INF=1ll<<59;
ll solve() {
  cin>>n;
  fore(i,0,n)cin>>a[i];
  fore(j,0,64) {
    bool br=1;
    fore(i,1,n)if(a[i]<a[i-1])br=0;
    if(br)return j;
    fore(i,1,n) {
      if(a[i]>=a[i-1])continue;
      if((a[i-1]-a[i])<=(1ll<<j)) {
        a[i]+=(1ll<<j);
      }
    }
    // cout<<"after "<<j<<": ";fore(i,0,n)cout<<a[i]<<" ";cout<<endl;
  }
  assert(0);
}
main() {FIN;
  ll q;cin>>q;
  while(q--)cout<<solve()<<"\n";
}
/*
10 9 8 2

1
6
10 9 12 11 14 13
*/


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> ii;
#define db(x) cout<<#x<<" = "<<x<<"\n";
#define fore(i,a,b) for(ll i=a,ggdem=b;i<ggdem;i++)
#define FIN ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define SZ(a) ((ll)(a).size())
#define ALL(a) a.begin(),a.end()
#define mset(a,b) memset(a,b,sizeof(a));
#define pb push_back
#define fst first
#define snd second
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll N=3e5+15;
ll n,a[N];
const ll INF=1ll<<60;
ll solve() {
  cin>>n;
  fore(i,0,n)cin>>a[i];
  ll cur=1,res=0;
  fore(i,1,n) {
    if(a[i]<a[i-1]) {
      ll x=a[i-1]-a[i];
      while(cur<x) {
        x-=cur;
        cur=cur*2;
        res++;
      }
      res++;
      if(cur<INF)cur=cur*2;
    }
  }
  return res;
}
main() {FIN;
  ll q;cin>>q;
  while(q--)cout<<solve()<<"\n";
}


#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define ll long long
#define fr(i,n) for(int i=0;i<n;++i)
#define fr1(i,n) for(int i=1;i<=n;++i)
#define p0(a) cout << a <<" "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
#define INF (ll)1e18 + 100

const int  mod = 1e9 +7;
const int mod1= 998244353;
bool local_maxima(int a, int  b, int c){
	return (a<b && b>c);
}

bool local_minima(int a, int  b, int c){
	return (a>b && b<c);
}

void solve(){ int t; cin>>t;while(t--)
{

  int n; cin>>n;vector<int> a(n);
  fr(i,n) cin>>a[i];
  if(n==1) { cout<<0<<endl; continue;}
  if(n==2) {
  	if(a[0]<=a[1]) { cout<<0<<endl; continue;}
  	else {cout<<( (int)(log2(a[0]-a[1])) +1)<<endl; continue;}
  }
  /*
	logic find max drop in height from it's peak
  */
  vector<int> peak;
  int hgt=-1;
  if(a[0]>a[1]){peak.push_back(a[0]);}

  fr1(i,n-2){
  	if(local_maxima(a[i-1],a[i],a[i+1])){ peak.push_back(a[i]);	}
  	else if(local_minima(a[i-1],a[i],a[i+1])){ peak.push_back(a[i]);}
  };
  peak.push_back(a[n-1]);
  {
  	if(peak.size()==2) {cout<<( (int)(log2(peak[0]-peak[1])) +1)<<endl; continue;}
  	if(peak.size()==1) {cout<<0<<endl; continue;}
  }
  fr(i,peak.size()-1){
  	hgt = max(hgt,peak[i]-peak[i+1]);
  }
  cout<<( (int)(log2(hgt)) +1)<<endl;

}return;} //while loop and solve ends respectively

signed main() {
	// your code goes here
	solve();
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int N = 100005;
int val[2 * N];
int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= 2 * n; i++)
		cin >> val[i];
	sort(val + 1, val + 1 + 2 * n);
	long long mn = (val[n] - val[1]) * (val[2 * n] - val[n + 1]);
	for (int i = 2; i <= n + 1; i++)
	{
		long long tmp = (val[1] * val[2 * n])*(val[i] * val[i + n - 1]);
		if (tmp < mn)
			mn = tmp;
	}
	cout << mn << endl;
}


#include<bits/stdc++.h>
using namespace std;
const int N = 100005;
long long val[2 * N];
int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= 2 * n; i++)
		cin >> val[i];
	sort(val + 1, val + 1 + 2 * n);
	long long mn = (val[n] - val[1]) * (val[2 * n] - val[n + 1]);
	for (int i = 2; i <= n + 1; i++)
	{
		long long tmp = (val[1] - val[2 * n])*(val[i] - val[i + n - 1]);
		mn = min(mn, tmp);
	}
	cout << mn << endl;
}


#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pii pair<ll,ll>
#define mod 1000000007 //998244353
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}
void solve()
{
  ll n;
  cin>>n;

  ll a[2*n];

  for(ll i=0;i<2*n;i++)
  cin>>a[i];

  if(n==1){
      cout<<"0\n";
      return;
  }
  sort(a,a+2*n);

  ll ans=(a[n-1]-a[0])*(a[2*n-1]-a[n]);

  ll mn=INF;

  ll g=a[2*n-1]-a[0];

  for(ll i=1;i<=n-1;i++){

      mn=min(mn,a[i+n-1]-a[i]);
  }

  g*=mn;

  ans=min(mn,ans);

  cout<<ans<<endl;

}
int32_t main()
{    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);

//Start from Here.

  ll t;
  t=1;
 // cin>>t;
  while(t--)
  solve();

//Good Bye!
    return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pii pair<ll,ll>
#define mod 1000000007 //998244353
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}
void solve()
{
  ll n;
  cin>>n;

  ll a[2*n];

  for(ll i=0;i<2*n;i++)
  cin>>a[i];

  sort(a,a+2*n);

  ll ans=(a[n-1]-a[0])*(a[2*n-1]-a[n]);

  ll mn=INF;

  ll g=a[2*n-1]-a[0];

  for(ll i=1;i<n-1;i++){

      mn=min(mn,a[i+n-1]-a[i]);
  }

  g*=mn;

  ans=min(mn,ans);

  cout<<ans<<endl;

}
int32_t main()
{    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);

//Start from Here.

  ll t;
  t=1;
 // cin>>t;
  while(t--)
  solve();

//Good Bye!
    return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pii pair<ll,ll>
#define mod 1000000007 //998244353
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}
void solve()
{
  ll n;
  cin>>n;

  ll a[2*n];

  for(ll i=0;i<2*n;i++)
  cin>>a[i];

  if(n==1){
      cout<<"0\n";
      return;
  }
  sort(a,a+2*n);

  ll ans=(a[n-1]-a[0])*(a[2*n-1]-a[n]);

  ll mn=INF;

  ll g=a[2*n-1]-a[0];

  for(ll i=1;i<=n-1;i++){

      mn=min(mn,a[i+n-1]-a[i]);
  }

  g*=mn;

  ans=min(g,ans);

  cout<<ans<<endl;

}
int32_t main()
{    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);

//Start from Here.

  ll t;
  t=1;
 // cin>>t;
  while(t--)
  solve();

//Good Bye!
    return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e10
#define pii pair<ll,ll>
#define mod 1000000007 //998244353
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}
void solve()
{
  ll n;
  cin>>n;

  ll a[2*n];

  for(ll i=0;i<2*n;i++)
  cin>>a[i];

  sort(a,a+2*n);

  ll ans=(a[n-1]-a[0])*(a[2*n-1]-a[n]);

  ll mn=INF;

  ll g=a[2*n-1]-a[0];

  for(ll i=1;i<=n-1;i++){

      mn=min(mn,a[i+n-1]-a[i]);
  }

  g*=mn;

  ans=min(mn,ans);

  cout<<ans<<endl;

}
int32_t main()
{    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);

//Start from Here.

  ll t;
  t=1;
 // cin>>t;
  while(t--)
  solve();

//Good Bye!
    return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e10
#define pii pair<ll,ll>
#define mod 1000000007 //998244353
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}
void solve()
{
  ll n;
  cin>>n;

  ll a[2*n];

  for(ll i=0;i<2*n;i++)
  cin>>a[i];

  sort(a,a+2*n);

  ll ans=(a[n-1]-a[0])*(a[2*n-1]-a[n]);

  ll mn=INF;

  ll g=a[2*n-1]-a[0];

  for(ll i=1;i<n-1;i++){

      mn=min(mn,a[i+n-1]-a[i]);
  }

  g*=mn;

  ans=min(mn,ans);

  cout<<ans<<endl;

}
int32_t main()
{    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);

//Start from Here.

  ll t;
  t=1;
 // cin>>t;
  while(t--)
  solve();

//Good Bye!
    return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pii pair<ll,ll>
#define mod 1000000007 //998244353
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}
void solve()
{
  ll n;
  cin>>n;

  ll a[2*n];

  for(ll i=0;i<2*n;i++)
  cin>>a[i];

  sort(a,a+2*n);

  ll ans=(a[n-1]-a[0])*(a[2*n-1]-a[n]);

 /* ll mn=INF;

  ll g=a[2*n-1]-a[0];

  for(ll i=1;i<=n-1;i++){

      mn=min(mn,a[i+n-1]-a[i]);
  }

  g*=mn;

  ans=min(mn,ans);*/

  cout<<ans<<endl;

}
int32_t main()
{    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);

//Start from Here.

  ll t;
  t=1;
 // cin>>t;
  while(t--)
  solve();

//Good Bye!
    return 0;
}