#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, index = 0, maxi = INT_MIN, x = 0;
    cin >> n;
    std::vector<long long int> v(n);
    for (auto &x : v) cin >> x;
    for (long long int i = 0; i < n - 1; i++) {
      if (v[i] > v[i + 1]) {
        long long int y = v[i];
        while (y > v[i + 1] && i < n - 1) {
          maxi = max(maxi, y - v[i + 1]);
          i++;
        }
      }
    }
    long long int y = 0;
    if (maxi == INT_MIN || maxi == 0) {
      cout << 0 << endl;
      continue;
    }
    for (long long int i = 0; i < mod; i++) {
      x += pow(2, i);
      y = pow(2, i);
      if (y >= maxi) {
        index = i + 1;
        break;
      }
      if (x >= maxi) {
        index = i + 1;
        break;
      }
    }
    cout << index << endl;
  }
}
