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