#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const int INF = 0x3f3f3f3f;
long long n, m, x, y, cnt, t, T;
map<int, int> M;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> T;
  while (T--) {
    cin >> n;
    M.clear();
    m = 0;
    for (long long i = 1; i <= n; ++i) {
      cin >> x;
      if (M[x]) ++m;
      M[x]++;
    }
    cout << n - m << endl;
  }
  return 0;
}
