#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 30;
const int N = 100100;
int n, a[N], q;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    set<int> se;
    for (int i = 1; i <= n; i++) {
      scanf("%d", a + i);
      se.insert(a[i]);
    }
    printf("%d\n", (int)se.size());
  }
  return 0;
}
