#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    vector<long long int> arr;
    long long int num;
    for (int i = 0; i < n; i++) {
      cin >> num;
      arr.push_back(num);
    }
    sort(arr.begin(), arr.end());
    long long int sum = 0;
    for (int i = 0; i < n - 1; i++) {
      if (arr[i] != arr[i + 1]) {
        sum++;
      }
    }
    cout << sum + 1 << endl;
  }
}
