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