#include <bits/stdc++.h>
int cmp(const void *a, const void *b) { return *(int *)a - *(int *)b; }
int main() {
  int i, t;
  scanf("%d", &i);
  for (t = 0; t < i; t++) {
    int m, n, a[100002] = {0}, sum = 0, k;
    scanf("%d", &m);
    for (n = 0; n < m; n++) {
      scanf("%d", &a[n]);
    }
    qsort(a, m, sizeof(a[0]), cmp);
    for (n = 0; n < m; n++) {
      k = 1;
      while (a[n] == a[n + k]) {
        sum++;
        n++;
      }
    }
    printf("%d\n", m - sum);
  }
  return 0;
}
