#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> vec;
    set<int> ss;
    for (int i = 0; i < n; i++) {
      int aa;
      cin >> aa;
      vec.push_back(aa);
    }
    for (int i = 0; i < n; i++) {
      int bb = vec[i];
      ss.insert(bb);
    }
    cout << ss.size() << endl;
  }
}
