#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long int t;
  cin >> t;
  while (t--) {
    unsigned long long int m, n;
    cin >> n;
    unsigned long long int i, j;
    set<unsigned long long int> v;
    unsigned long long int arr[n];
    for (i = 0; i < n; i++) cin >> arr[i];
    for (i = 0; i < n; i++) v.insert(arr[i]);
    cout << v.size() << endl;
  }
}
