#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
// Function to check if it's possible to divide the array into 'block_count' blocks
// where the difference between the maximum and minimum element in each block is the same
bool isValidBlockDivision(const vector<int>& arr, int N, int block_size) {
// We need to divide the array into `block_count` blocks
int block_count = N / block_size;
// Traverse through the array in blocks of size 'block_size'
for (int i = 0; i < block_count; ++i) {
int start = i * block_size;
int end = start + block_size - 1;
// Find the minimum and maximum element in the current block
int min_elem = arr[start];
int max_elem = arr[start];
for (int j = start + 1; j <= end; ++j) {
min_elem = min(min_elem, arr[j]);
max_elem = max(max_elem, arr[j]);
}
// Check if the difference between max and min is the same for all blocks
if (max_elem - min_elem != arr[end] - arr[start]) {
return false;
}
}
return true;
}
int main() {
int T;
cin >> T;
while (T--) {
int N;
cin >> N;
vector<int> arr(N);
for (int i = 0; i < N; ++i) {
cin >> arr[i];
}
// Sort the array first to simplify checking the block condition
sort(arr.begin(), arr.end());
int max_blocks = 0;
// Try all possible block sizes that divide N
for (int block_size = 2; block_size <= N; ++block_size) {
if (N % block_size == 0) {
if (isValidBlockDivision(arr, N, block_size)) {
max_blocks = max(max_blocks, N / block_size);
}
}
}
// Output the maximum number of blocks
cout << max_blocks << endl;
}
return 0;
}