#include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
using ll = long long;
int main() {
FAST;
int tc = 1, ti;
cin >> tc;
for (ti = 1; ti <= tc; ++ti) {
int n, i, blocks;
cin >> n;
vector<int> a(n);
for (i = 0; i < n; ++i) cin >> a[i];
sort(a.begin(), a.end());
set<int> diffs;
for (i = 1; i < n; ++i) diffs.insert(a[i]-a[0]);
auto possible = [&](int num, int diff) -> bool {
multiset<int> st(a.begin(), a.end());
vector<pair<int,int>> pairs;
int i, x, y;
for (i = 0; i < num; ++i) {
x = *st.begin();
st.erase(st.begin());
y = x + diff;
auto it = st.find(y);
if (it == st.end()) return 0;
st.erase(it);
pairs.emplace_back(x, y);
}
sort(pairs.begin(), pairs.end());
for (auto [l, r] : pairs) {
while (!st.empty()) {
x = *st.begin();
if (x < l) return 0;
if (x > r) break;
st.erase(st.begin());
}
}
return st.empty();
};
for (blocks = n-1; blocks >= 1; --blocks) {
if (n % blocks != 0) continue;
bool f = 0;
for (int d : diffs) {
if (possible(blocks, d)) f = 1;
}
if (f) break;
}
cout << blocks << "\n";
}
return 0;
}