#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
long long int nom(long long int a, long long int b) {
  if (a >= b) return 0;
  long long int diff = b - a;
  if ((diff & (diff - 1)) == 0) return log2(diff) + 1;
  long long int moves = log2(diff);
  if (a + pow(2, moves) - 1 >= b) return moves;
  if (a + pow(2, moves + 1) - 1 >= b) return moves + 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int a[n], mini = INT_MAX, ans[n];
    for (long long int i = 0; i < n; i++) {
      cin >> a[i];
      ans[i] = a[i];
    }
    set<pair<long long int, long long int> > s;
    for (long long int i = 0; i < n; i++) s.insert({a[i], i});
    long long int cur = 0, x = 0;
    while (!s.empty()) {
      pair<long long int, long long int> tem = *(s.begin());
      s.erase(s.find({a[cur], cur}));
      x = max(x, nom(tem.first, ans[cur]));
      cur++;
    }
    cout << x << endl;
  }
  return 0;
}
