#include <bits/stdc++.h>
using namespace std;
int a[100100];
int main() {
  ios::sync_with_stdio(0);
  int T;
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> a[i];
    sort(a, a + n);
    int res = 1;
    for (int i = 1; i < n; ++i) {
      if (a[i] != a[i - 1]) res++;
    }
    printf("%d\n", res);
  }
}
