#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int n;
    cin >> n;
    int *arr = new int[n];
    for (int i = 0; i < n; i++) cin >> arr[i];
    unordered_map<int, bool> mymap;
    int coun = 0;
    for (int i = 0; i < n; i++) {
      if (!mymap.count(arr[i])) {
        coun++;
        mymap[arr[i]] = true;
      }
    }
    cout << coun << endl;
  }
}
