#include #include #include #include #include #include #include using namespace std; long long a[100000]; set set1; int main() { long long n,m,T,i,j; cin >> T; while (T--){ cin >> n; set1.clear(); for (i=1;i<=n;i++) { scanf("%I64d",&a[i]); set1.insert(a[i]); } copy(set1.begin(),set1.end(),a); n=set1.size(); long long ans=0; for (int i=0;i