#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    int dif[n];
    memset(dif, 0, sizeof(dif));
    int ans = 0;
    for (int i = 1; i < n; i++) {
      int cnt = 1;
      int temp = a[i];
      while (a[i - 1] > a[i]) {
        dif[i]++;
        a[i] = temp + cnt;
        cnt *= 2;
      }
      if (a[i] > a[i - 1] && dif[i]) {
        dif[i]--;
        a[i] = a[i - 1];
      }
      ans = max(ans, dif[i]);
    }
    cout << ans << "\n";
  }
  return 0;
}
