#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  for (; t; --t) {
    int n;
    cin >> n;
    vector<long long> v(n);
    bool tk[40] = {0};
    for (int i = 0; i < n; ++i) cin >> v[i];
    vector<long long> v2(n);
    int ans = 40;
    for (int mxad = 0; mxad <= 35; ++mxad) {
      memset(tk, 0, sizeof(tk));
      if (mxad)
        for (int j = 0; j < mxad; ++j) tk[j] = 1;
      for (int j = 0; j < n; ++j) v2[j] = v[j];
      bool ok = 1;
      for (int i = 1; i < n; ++i) {
        if (v2[i] >= v2[i - 1]) continue;
        long long nr = v2[i];
        for (int x = mxad - 1; x >= 0; --x)
          if (tk[x]) nr += (1LL << x);
        for (int x = mxad - 1; x >= 0; --x)
          if (nr >= v2[i - 1] && nr - (1LL << x) >= v2[i - 1]) nr -= (1LL << x);
        if (nr < v2[i - 1]) {
          ok = 0;
          break;
        }
        v2[i] = nr;
      }
      if (ok) {
        ans = mxad;
        break;
      }
    }
    cout << ans << '\n';
  }
  return 0;
}
