//KZNS
#include <cstdio>
#include <algorithm>
using namespace std;
int N;
int ls[103];
void work() {
scanf("%d", &N);
for (int i = 0; i < N; i++)
scanf("%d", ls+i);
sort(ls, ls+N);
int ans = 0;
int K, A;
int ct;
for (int i = 0; i < N; i++) {
for (int j = i+1; j < N; j++) {
K = ls[j] - ls[i];
A = ls[j];
ct = 2;
for (int k = j+1; k < N; k++) {
if (A + K == ls[k]) {
ct++;
A = ls[k];
}
else if (A + K > ls[k]) {
break;
}
}
ans = max(ans, ct);
}
}
for (int i = 0; i < N; i++) {
for (int j = i+1; j < N; j++) {
if (ls[j] % ls[i])
continue;
K = ls[j] / ls[i];
A = ls[j];
ct = 2;
for (int k = j+1; k < N; k++) {
if ((long long)A * K == ls[k]) {
ct++;
A = ls[k];
}
else if ((long long)A * K > ls[k]) {
break;
}
}
ans = max(ans, ct);
}
}
for (int i = 0; i < N; i++) {
for (int j = i+1; j < N; j++) {
if (ls[j] % ls[i])
continue;
K = ls[j] / ls[i];
A = ls[j];
ct = 2;
for (int k = j+1; k < N; k++) {
if (A * K == ls[k]) {
ct++;
A = ls[k];
}
else if (A * K > ls[k]) {
break;
}
}
ans = max(ans, ct);
}
}
for (int i = 0; i < N; i++) {
for (int j = i+1; j < N; j++)
if (ls[j] == ls[i])
ct++;
ans = max(ans, ct);
}
ct = 0;
bool fff = false;
for (int i = 0; i < N; i++) {
if (ls[i] == 1)
ct++;
else if (ls[i])
fff = true;
}
if (fff)
ct++;
ans = max(ans, ct);
printf("%d\n", ans);
}
int main() {
freopen("series.in", "r", stdin);
freopen("series.out", "w", stdout);
int T;
scanf("%d", &T);
while (T--) {
work();
}
return 0;
}
//UBWH