#include <bits/stdc++.h>
using namespace std;
int main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int largest = INT_MIN;
    int a[n];
    bool flag = false;
    int maxdiff = 0;
    for (int x = 0; x < n; x++) {
      cin >> a[x];
      largest = max(largest, a[x]);
      maxdiff = max(largest - a[x], maxdiff);
      if (x > 0 && a[x] < a[x - 1]) {
        flag = true;
      }
    }
    if (!flag) {
      cout << "0\n";
      continue;
    }
    double x = log2(maxdiff + 1);
    long long int ans = (long long int)ceil(x);
    cout << ans << '\n';
  }
  return 0;
}
