#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t; using u32 = uint32_t;
using u64 = uint64_t; using u128 = __uint128_t;
using ll = long long; using lld = long double; using ull = unsigned long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define el '\n'
#define nl cout << "\n"
#define ws " "
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define nai cout << "-1\n"
#define pbk push_back
#define mkp make_pair
#define ff first
#define ss second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define vec vector
#define vi vector<int>
#define vl vector<ll>
#define popcnt(x) __builtin_popcountll(x)
#ifdef LOCAL
#include "cf_template.cpp"
#else
#define debug(...)
#define debugArr(...)
#endif
template<typename T> void print(const T& a) { cout << a << "\n"; }
template<typename T> void print(const vector<T>& v)
{ for (auto& x : v) cout << x << " "; cout << "\n"; }
template<typename T, typename... Args>
void print(const T& first, const Args&... rest)
{ cout << first; ((cout << ' ' << rest), ...); cout << '\n'; }
static inline int msb_index(ull x) {
return 63 - __builtin_clzll(x);
}
void sed() {
int n; cin >> n;
vi dp(61), msb[61];
vl arr(n);
rep(i, n) {
cin >> arr[i];
if (!arr[i]) continue;
int m = msb_index(arr[i]);
msb[m].pbk(i); dp[m] = 1;
}
for (int i = 1; i < 61; i++) {
for (auto ind : msb[i]) {
for (int j = i - 1; j >= 0; j--) {
if (!(arr[ind] & (1ll << j))) continue;
dp[i] = max(dp[i], 1 + dp[j]);
}
}
}
int ans = *max_element(all(dp));
print(max(1, ans));
}
int32_t main(void) {
ios::sync_with_stdio(false); cin.tie(nullptr);
int t = 1;
cin >> t;
for (int i = 1; i <= t; i++)
sed();
}