#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
const long long mod = 1e9 + 7;
const long long mod2 = 998244353;
const long long inf = 8e18;
const int LOG = 22;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int arr[n];
    for (long long i = 0; i < n; i++) cin >> arr[i];
    int mn = -1;
    for (int i = 1; i < n; i++) {
      if (arr[i] < arr[i - 1]) {
        int mn1 = -1, j;
        for (j = i; j < n; j++) {
          if (arr[j] < arr[i - 1]) {
            mn1 = max(mn1, arr[i - 1] - arr[j]);
          } else
            break;
        }
        i = j - 1;
        mn = max(mn, mn1);
      }
    }
    int res = log2(mn) + 1;
    if (res < 0)
      cout << 0 << "\n";
    else
      cout << res << "\n";
  }
  return 0;
}
