#include <bits/stdc++.h>
using namespace std;
long long int insig;
void Out(vector<long long int> x) {
  for (long long int i = 0; i < x.size(); i++) {
    cout << x[i] << " ";
  }
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int T;
  cin >> T;
  for (long long int t = 0; t < T; t++) {
    long long int N;
    cin >> N;
    vector<long long int> a;
    for (long long int IBRO = 0; IBRO < N; IBRO++) {
      cin >> insig;
      a.push_back(insig);
    };
    long long int minv = 1000000000000LL;
    long long int maxdif = -1000000000000LL;
    for (long long int i = N - 1; i >= 0; i--) {
      maxdif = max(maxdif, a[i] - minv);
      minv = min(minv, a[i]);
    }
    maxdif++;
    long long int ans = (long long int)ceil(log2(maxdif));
    cout << max(0LL, ans) << endl;
  }
  return 0;
}
