#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int t = 0;
  cin >> t;
  while (t-- > 0) {
    int n = 0;
    cin >> n;
    vector<int> a(n);
    for (auto &x : a) cin >> x;
    sort(a.begin(), a.end());
    vector<int> b;
    b.push_back(a[0]);
    for (int i = 1; i < n; ++i)
      if (b[(int)b.size() - 1] != a[i]) b.push_back(a[i]);
    cout << (int)b.size() << endl;
  }
}
