#include <bits/stdc++.h>
using namespace std;
long long a[1000005];
long long b[1000005];
long long _2[40];
long long t, n;
int main() {
  _2[0] = 1;
  for (int i = 1; i <= 35; i++) {
    _2[i] = _2[i - 1] * 2;
  }
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n;
    for (long long i = 0; i < n; i++) cin >> a[i];
    bool good = 1;
    for (long long i = 1; i < n; i++)
      if (a[i] < a[i - 1]) good = 0;
    if (good) {
      cout << "0\n";
      continue;
    }
    long long ans = 100;
    for (long long x = 1; x <= 32; x++) {
      good = 1;
      for (long long i = 0; i < n; i++) b[i] = a[i];
      for (long long i = 1; i < n; i++) {
        if (b[i] >= b[i - 1]) {
          continue;
        }
        if (b[i - 1] - b[i] <= _2[x] - 1) {
          b[i] = b[i - 1];
        } else {
          good = 0;
          break;
        }
      }
      if (good) {
        ans = x;
        break;
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
