def max_blocks(T, test_cases):
results = []
for case in test_cases:
N, A = case
A_sorted = sorted(A)
max_blocks_found = 1 # At least one block (the entire array)
# Iterate over possible block sizes
for k in range(2, N + 1):
if N % k != 0:
continue # Block size must divide N
num_blocks = N // k
valid = True
target_diff = None
# Check each block
for i in range(num_blocks):
start = i * k
end = start + k
block = A_sorted[start:end]
current_diff = block[-1] - block[0]
if target_diff is None:
target_diff = current_diff
elif current_diff != target_diff:
valid = False
break
if valid:
max_blocks_found = max(max_blocks_found, num_blocks)
results.append(max_blocks_found)
return results
# Input reading
T = int(input())
test_cases = []
for _ in range(T):
N = int(input())
A = list(map(int, input().split()))
test_cases.append((N, A))
# Compute results
results = max_blocks(T, test_cases)
# Output results
for res in results:
print(res)