#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed;
  cout.precision(10);
  int T = 1;
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    int a[n];
    set<int> s;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      s.insert(a[i]);
    }
    cout << s.size() << "\n";
  }
  return 0;
}
