#include <bits/stdc++.h>
using namespace std;
const int N = 200000 + 100;
const long double pi = acos(-1.0);
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while ((ch < '0') || (ch > '9')) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while ((ch >= '0') && (ch <= '9')) {
    x = x * 10 + (ch - '0');
    ch = getchar();
  }
  return x * f;
}
inline long long readll() {
  long long x = 0;
  int f = 1;
  char ch = getchar();
  while ((ch < '0') || (ch > '9')) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while ((ch >= '0') && (ch <= '9')) {
    x = x * 10 + (ch - '0');
    ch = getchar();
  }
  return x * f;
}
int n, a[N];
int main() {
  int T = read();
  while (T--) {
    n = read();
    int mx = 0;
    for (register int i = 1; i <= n; i++) {
      a[i] = read();
      mx = max(mx, a[i]);
    }
    int ans = n;
    for (register int i = 1; i <= n; i++)
      if (a[i] != mx) {
        ans = 1;
        break;
      }
    printf("%d\n", ans);
  }
  return 0;
}
