#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int num;
    if (n == 1) {
      cin >> num;
      cout << 1 << endl;
    } else {
      set<int> myset;
      for (int i = 0; i < n; ++i) {
        cin >> num;
        myset.insert(num);
      }
      cout << myset.size() << '\n';
    }
  }
  return 0;
}
