#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long T;
  cin >> T;
  while (T--) {
    long long n;
    cin >> n;
    long long a;
    set<long long> s;
    for (long long i = 0; i < n; i++) {
      cin >> a;
      s.insert(a);
    }
    cout << s.size() << endl;
  }
}
