#include <bits/stdc++.h>
using namespace std;
bool possible(long long x, vector<long long> a) {
  long long n = (long long)(a).size();
  if (x == 0) {
    for (long long i = 1; i < n; i++) {
      if (a[i] < a[i - 1]) return false;
    }
    return true;
  }
  for (long long i = 1; i < n; i++) {
    if (a[i] < a[i - 1]) {
      long long diff = a[i - 1] - a[i];
      long long ma = 1ll << (x)-1;
      if (diff > ma)
        return false;
      else
        a[i] = a[i - 1];
    }
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long T;
  cin >> T;
  while (T--) {
    long long n;
    cin >> n;
    vector<long long> a(n);
    for (long long i = 0; i < n; i++) cin >> a[i];
    long long prev = a[0];
    long long diff = 0;
    for (long long i = 1; i < n; i++) {
      if (a[i] < prev) {
        diff = max(diff, prev - a[i]);
      } else
        prev = a[i];
    }
    if (diff > 0) {
      cout << (long long)log2(diff) + 1 << endl;
    } else {
      cout << 0 << endl;
    }
  }
}
