#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> ar(n);
    for (int i = 0; i < n; i++) {
      cin >> ar[i];
    }
    int mx = 0, i = 0, j = 1, f = 0, mn = 1e9 + 1;
    while (j < n) {
      if (ar[i] > ar[j]) {
        f = 1;
        mn = min(mn, ar[j]);
        j++;
        continue;
      }
      if (ar[i] <= ar[j] & f == 1) {
        f = 0;
        mx = max(mx, (ar[i] - mn));
        mn = 1e9 + 1;
        i = j;
        j++;
        continue;
      }
      i++;
      j++;
    }
    if (f == 1) {
      mx = max(mx, ar[i] - mn);
    }
    int res = 0;
    if (mx > 0) {
      res = log2(mx) + 1;
    }
    cout << res << "\n";
  }
  return 0;
}
