#include <bits/stdc++.h>
using namespace std;
long tknp(vector<long> a, long n, long x) {
  long left = 0;
  long right = n - 1;
  while (left <= right) {
    long mid = (left + right) / 2;
    if (x == a[mid])
      return x;
    else if (x < a[mid])
      right = mid - 1;
    else if (x > a[mid])
      left = mid + 1;
  }
  return -1;
}
void process() {
  ios::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  long t;
  cin >> t;
  for (long k = 0; k < t; ++k) {
    long n;
    cin >> n;
    long a[n];
    vector<long> b;
    for (long i = 0; i < n; ++i) {
      cin >> a[i];
    }
    sort(a, a + n);
    for (long i = 0; i < n; ++i) {
      long kt;
      kt = tknp(b, b.size(), a[i]);
      if (kt != a[i]) b.push_back(a[i]);
    }
    cout << b.size() << endl;
  }
}
int main() { process(); }
