#include <bits/stdc++.h>
using namespace std;
bool check(long long n, long long pos) { return (n & (1 << pos)); }
bool Set(long long n, long long pos) { return (n | (1 << pos)); }
long double LOG(long double b, long double e) { return log(b) / log(e); }
void solve() {
  int n;
  long long x;
  cin >> n;
  set<long long> s;
  while (n--) cin >> x, s.insert(x);
  cout << s.size() << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
