#include <bits/stdc++.h>
using namespace std;
const int mxN = 3e5;
int n, arr[mxN];
void solve() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  set<int> store;
  for (int i = 0; i < n; i++) {
    if (store.find(arr[i]) == store.end()) store.insert(arr[i]);
  }
  cout << store.size() << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
