#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t;
  cin >> t;
  set<int> s;
  while (t--) {
    cin >> n;
    s.clear();
    for (int i = 0; i < n; ++i) {
      int x;
      cin >> x;
      s.insert(x);
    }
    cout << s.size() << endl;
  }
  return 0;
}
