#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int m;
    cin >> m;
    vector<int> v(m);
    for (int i = 0; i < v.size(); i++) {
      cin >> v[i];
    }
    sort(v.begin(), v.end());
    int sz = unique(v.begin(), v.end()) - v.begin();
    cout << sz << endl;
  }
  return 0;
}
