#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll inf = 1e18;
const int N = 2 * 1e5 + 10;
ll n;
ll res;
ll a[N];
bool ok(ll m) {
  ll prev = -inf;
  ll can = (1LL << m) - 1;
  for (int i = 0; i < n; ++i) {
    if (prev > a[i]) {
      if (a[i] + can < prev) return 0;
    }
    prev = max(a[i], prev);
  }
  return 1;
}
void solve() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  ll lo = -1, hi = 40;
  while (lo + 1 < hi) {
    ll m = lo + hi >> 1LL;
    if (ok(m))
      hi = m;
    else
      lo = m;
  }
  cout << hi << "\n";
}
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ll t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
