#include <bits/stdc++.h>
using namespace std;
int t, n, i, j, x;
set<int> s;
int main() {
  cin >> t;
  for (i = 1; i <= t; ++i) {
    cin >> n;
    for (j = 1; j <= n; ++j) {
      cin >> x;
      s.insert(x);
    }
    cout << s.size() << "\n";
    s.clear();
  }
}
