#include <bits/stdc++.h>
using namespace std;
void copy() {
  int n;
  cin >> n;
  ;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int count = 0;
  unordered_set<int> s;
  for (int i = 0; i < n; i++) {
    if (s.find(arr[i]) == s.end()) {
      s.insert(arr[i]);
      count++;
    }
  }
  cout << count << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    copy();
  }
}
