#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, c, d, e, f, toto, g, i, j, t, x, n, k, sum, p, q, fotka;
  cin >> t;
  while (t--) {
    cin >> n;
    long long int arr[n], brr[n];
    c = 1;
    for (i = 0; i < n; i++) cin >> arr[i];
    sort(arr, arr + n);
    k = 0;
    x = 1;
    for (i = 0; i < n - 1; i++) {
      if (arr[i] != arr[i + 1]) {
        k = 1;
        break;
      } else if (arr[i] == arr[i + 1]) {
        x++;
      }
    }
    if (k == 0)
      cout << x << endl;
    else
      cout << 1 << endl;
  }
  return 0;
}
