#include <bits/stdc++.h>
using namespace std;
const long long q = 239017;
const long long mod = 1e9 + 7;
const long long mod2 = 1e9 + 13;
const long long MAXN = 2e5 + 100;
const long long MAXM = 1e3 + 100;
const long long L = 26;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void $main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    set<long long> sit;
    for (long long i = 0; i < n; ++i) {
      long long x;
      cin >> x;
      sit.emplace(x);
    }
    cout << (long long)sit.size() << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  $main();
  return 0;
}
