#include <bits/stdc++.h>
using namespace std;
inline int read() {
  register int x = 0, f = 1;
  register char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
  return x * f;
}
void work() {}
int T, n, ans, a[200010];
signed main() {
  T = read();
  while (T--) {
    ans = 1;
    n = read();
    work();
    for (register int i = (1), iLimit = (n); i <= iLimit; (++(i)))
      a[i] = read();
    sort(a + 1, a + n + 1);
    for (register int i = (1), iLimit = (n - 1); i <= iLimit; (++(i)))
      if (a[i] != a[i + 1]) (++(ans));
    printf("%d\n", ans);
  }
  return 0;
  int zmy = 23123, cyz = 23232, dhsah = 232323;
}
