#include <bits/stdc++.h>
using namespace std;
int moduluss(int x) {
  if (x < 0)
    return -1 * x;
  else
    return x;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int x, y, n, max, ans = 0;
    cin >> n;
    vector<int> vec(n);
    for (int i = 0; i < n; i++) {
      cin >> vec[i];
      if (i == 0)
        max = vec[0];
      else {
        if (max > vec[i]) {
          int p = moduluss(max - vec[i]);
          x = ceil(log2(p));
          vec[i] += (pow(2, x) - 1);
          if (vec[i] >= max) {
            if (x > ans) ans = x;
          } else {
            vec[i]++;
            max = vec[i];
            if (x + 1 > ans) ans = x + 1;
          }
        } else
          max = vec[i];
      }
    }
    cout << ans << endl;
  }
  return 0;
}
