#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9 + 1;
const double PI = 3.141592653589793;
const double eps = 1e-9;
const int mod = 998244353;
long long power(long long a, long long n) {
  long long result = 1;
  long long prod = a;
  while (n > 0) {
    if (n % 2 == 1) {
      result *= prod;
    }
    prod *= prod;
    n /= 2;
  }
  return result;
}
void solve() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  long long ma = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    if (ma < a[i]) {
      ma = a[i];
    }
  }
  long long cnt = 0;
  for (int i = 0; i < n; ++i) {
    if (ma == a[i]) {
      ++cnt;
    }
  }
  if (cnt == n) {
    cout << n << '\n';
  } else {
    cout << 1 << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  cin >> t;
  while (t-- > 0) {
    solve();
  }
  return 0;
}
