#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> arr(n);
    for (int i = 0; i < n; i++) cin >> arr[i];
    long long mn[n];
    long long mx[n];
    long long ans1 = 0, ans2 = 0;
    mn[n - 1] = arr[n - 1];
    for (int i = n - 2; i >= 0; i--) {
      mn[i] = min(arr[i], mn[i + 1]);
    }
    for (int i = 0; i < n - 1; i++) {
      if (arr[i] > mn[i + 1]) {
        long long val = arr[i] - mn[i + 1];
        double v = log2(val);
        if ((long long)ceil(v) == (long long)floor(v)) {
          val = ceil(v) + 1;
        } else
          val = ceil(v);
        ans2 = max(ans2, val);
      }
    }
    long long ans = min(ans1, ans2);
    cout << ans2 << endl;
  }
}
