#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const double eps = 1e-9;
const int inf = 1e9;
long long a[N];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%lld", a + i);
    long long mx = -inf - 100;
    for (int i = 2; i <= n; i++) {
      if (a[i] < a[i - 1]) {
        mx = max(mx, a[i - 1] - a[i]);
        a[i] = a[i - 1];
      }
    }
    if (mx == -inf - 100) {
      printf("0\n");
      continue;
    }
    int ans = 0;
    for (int i = 33; i > -1; i--) {
      if (mx & (1ll << i)) {
        ans = i + 1;
        break;
      }
    }
    printf("%d\n", ans);
  }
}
