#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
map<int, int> ma;
int main() {
  int te;
  cin >> te;
  while (te--) {
    ma.clear();
    int n, x;
    cin >> n;
    for (int i = 0; i < n; ++i) {
      cin >> x;
      ma[x]++;
    }
    map<int, int>::iterator it;
    int ans = 0;
    for (it = ma.begin(); it != ma.end(); it++) ans++;
    cout << ans << endl;
  }
  return 0;
}
