#include <iostream>
#include <unordered_map>
#include <vector>
#include <algorithm>
using namespace std;
//w范围是1e18 32位装不下,需要64位,注意整数范围
int main() {
    int t;
    cin >> t;

    while(t--) {
        unordered_map<int64_t,int> group;
        int n;
        cin >> n;
        for(auto i = 0; i < n; i++) {
            int64_t v;
            cin >> v;
            auto get = false;
            auto key = v;
            int cnt = 1;
            for(auto it = group.begin(); it != group.end();) {
                if(it->first & key) {
                    cnt += it->second;
                    key |= it->first;
                    it = group.erase(it);
                } else {
                    it++;
                }
            }
            group[key] = cnt;
        }
        vector<int> all(group.size());
        int i = 0;
        for(auto& it : group) {
            all[i++] = it.second;
        }
        sort(all.begin(), all.end(), greater());
        cout << all[0] << endl;
    }
}
// 64 位输出请用 printf("%lld")