#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int arr[100000];
    for (int i = 0; i < n; i++) cin >> arr[i];
    sort(arr, arr + n);
    int ansArr[100000];
    int prev = -1;
    int curr = 0;
    for (int i = 0; i < n; i++) {
      if (prev != arr[i]) {
        ansArr[curr++] = arr[i];
        prev = arr[i];
      }
    }
    cout << curr << endl;
  }
}
