#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long a[n];
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
    }
    sort(a, a + n);
    long long ans = 1;
    for (long long i = 0; i < n - 1; i++) {
      if (a[i] != a[i + 1]) ans++;
    }
    cout << ans;
    cout << endl;
  }
  return 0;
}
