#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int tests;
  cin >> tests;
  while (tests--) {
    cin >> n;
    set<int> s;
    for (int i = 1; i <= n; i++) {
      int x;
      cin >> x;
      if (s.find(x) == s.end()) s.insert(x);
    }
    cout << s.size() << '\n';
  }
  return 0;
}
