#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, len, digit;
  cin >> t;
  while (t--) {
    digit = 0;
    cin >> n;
    int arr[n];
    vector<int> vec;
    vector<int>::iterator it;
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
    }
    sort(arr, arr + n);
    for (int i = 1; i <= n; i++) {
      if (arr[i - 1] != arr[i]) {
        digit++;
        vec.push_back(arr[i]);
      }
    }
    len = vec.size();
    if (digit == 0)
      cout << 1 << "\n";
    else
      cout << len << "\n";
  }
}
