#include <bits/stdc++.h>
const double PI = 3.141592653589793238460;
using namespace std;
string S, R;
int main() {
  int t;
  cin >> t;
  while (t-- > 0) {
    int n;
    cin >> n;
    int i;
    vector<int> v(n);
    for (i = 0; i < n; i++) cin >> v[i];
    sort(v.begin(), v.end());
    if (v.front() == v.back())
      cout << n << '\n';
    else
      cout << 1 << '\n';
  }
}
