#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  map<int, int> m;
  int c = 0;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    if (m.find(t) == m.end()) {
      m[t] = 1;
      c++;
    }
  }
  cout << c;
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int q = 1;
  cin >> q;
  while (q--) {
    solve();
    cout << endl;
  }
  return 0;
}
