#include <bits/stdc++.h>
using namespace std;
int main() {
  int tests;
  scanf("%d", &tests);
  while (tests--) {
    int item;
    cin >> item;
    vector<int> v;
    set<int> s;
    int temp;
    for (int i = 0; i < item; i++) {
      scanf("%d", &temp);
      v.push_back(temp);
      s.insert(temp);
    }
    int distinct = 0;
    cout << s.size() << '\n';
  }
  return 0;
}
