#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int a;
    cin >> a;
    int b[a];
    std::vector<int> c;
    for (int i = 0; i < a; i++) {
      cin >> b[i];
    }
    sort(b, b + a);
    for (int i = 1; i < a; i++) {
      if (b[i - 1] != b[i]) {
        c.push_back(b[i - 1]);
      }
    }
    cout << c.size() + 1 << "\n";
  }
  return 0;
}
