#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    vector<int> v;
    int n;
    cin >> n;
    int p = n;
    while (p--) {
      int k;
      cin >> k;
      v.push_back(k);
    }
    sort(v.begin(), v.end());
    if (v.front() == v.back()) {
      cout << n << endl;
    } else {
      cout << "1" << endl;
    }
  }
}
