#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long LINF = 1e18;
const int MOD = 1000000007;
const int N = 300555;
const int M = 1155;
int a[N];
void solve() {
  int n;
  cin >> n;
  set<int> s;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    s.insert(x);
  }
  cout << ((int)s.size()) << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  int T = 1;
  cin >> T;
  while (T--) {
    solve();
  }
  return 0;
}
