#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e6 + 1;
int n, a[N];
void solve() {
  cin >> n;
  set<int> s;
  for (int i = 1; i <= n; i++) cin >> a[i], s.insert(a[i]);
  cout << (int)s.size() << '\n';
}
int main() {
  cin.tie(0)->sync_with_stdio(0);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
