#include<time.h>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<vector>
using namespace std;
int compare(const void *a, const void *b)
{
int c = *(int *)a;
int d = *(int *)b;
if(c < d) {return -1;}
else if (c == d) {return 0;}
else return 1;
}
bool cmp(int i, int j)
{
return i < j ;
}
int main()
{
vector<int> vec ;
int total ;
scanf("%d",&total);
while(total > 0)
{
int num ;
scanf("%d",&num);
for(int i = 0, x ; i < num ; i++)
{
scanf(" %d",&x);
vec.push_back(x);
}
sort(vec.begin(),vec.end(),cmp);
//for(int i = 0 ; i < num ; i++)
// printf("%d ",vec[i]);
int same = 0 ;
for(int i = 0 ; i < num ; i++)
{
if( i + 1 < vec.size() && vec[i] == vec[i+1] )
same++;
}
printf("%d\n",num-same);
vec.clear();
total--;
}
}