#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n, h[1000000] = {0};
    scanf("%d", &n);
    int count = 0;
    while (n--) {
      int temp;
      scanf("%d", &temp);
      if (h[temp] == 0) {
        count++;
        h[temp]++;
      }
    }
    printf("%d\n", count);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3d0920,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1212 <main+0xe2>
lea    -0x3d0910(%rbp),%rdi
xor    %esi,%esi
mov    $0x3d0900,%edx
call   1040 <memset@plt>
lea    0xe80(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0x3d0914(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     11fb <main+0xcb>
lea    0xe52(%rip),%rdi
lea    -0x3d0918(%rbp),%rsi
call   1050 <scanf@plt>
movslq -0x3d0918(%rbp),%rax
cmpl   $0x0,-0x3d0910(%rbp,%rax,4)
jne    11f6 <main+0xc6>
mov    -0x3d0914(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3d0914(%rbp)
movslq -0x3d0918(%rbp),%rax
mov    -0x3d0910(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x3d0910(%rbp,%rax,4)
jmp    1193 <main+0x63>
mov    -0x3d0914(%rbp),%esi
lea    0xdfb(%rip),%rdi
call   1030 <printf@plt>
jmp    1152 <main+0x22>
xor    %eax,%eax
add    $0x3d0920,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3d0918,%rsp
lea    0xeb8(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
subl   $0x1,0x8(%rsp)
jae    116d <main+0x3d>
xor    %eax,%eax
add    $0x3d0918,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x10(%rsp),%r14
lea    0xe87(%rip),%rbx
lea    0x4(%rsp),%r15
lea    0xe7e(%rip),%r12
lea    0xc(%rsp),%r13
jmp    11a1 <main+0x71>
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
subl   $0x1,0x8(%rsp)
jb     1159 <main+0x29>
xor    %ebp,%ebp
mov    $0x3d0900,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
subl   $0x1,0x4(%rsp)
jb     1190 <main+0x60>
xor    %ebp,%ebp
jmp    11d7 <main+0xa7>
nopl   0x0(%rax,%rax,1)
subl   $0x1,0x4(%rsp)
jb     1190 <main+0x60>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
movslq 0xc(%rsp),%rax
cmpl   $0x0,0x10(%rsp,%rax,4)
jne    11d0 <main+0xa0>
add    $0x1,%ebp
movl   $0x1,0x10(%rsp,%rax,4)
jmp    11d0 <main+0xa0>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [1000000 x i32]
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %8
8: ; preds = %35, %0
%9 = load i32, i32* %2
%10 = add nsw i32 %9, -1
store i32 %10, i32* %2
%11 = icmp ne i32 %9, 0
br i1 %11, label %12, label %38
12: ; preds = %8
%13 = bitcast [1000000 x i32]* %4 to i8*
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 0, i32* %5
br label %15
15: ; preds = %34, %12
%16 = load i32, i32* %3
%17 = add nsw i32 %16, -1
store i32 %17, i32* %3
%18 = icmp ne i32 %16, 0
br i1 %18, label %19, label %35
19: ; preds = %15
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [1000000 x i32], [1000000 x i32]* %4, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %34
26: ; preds = %19
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [1000000 x i32], [1000000 x i32]* %4, i64 0, i64 %30
%32 = load i32, i32* %31
%33 = add nsw i32 %32, 1
store i32 %33, i32* %31
br label %34
34: ; preds = %26, %19
br label %15
35: ; preds = %15
%36 = load i32, i32* %5
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %36)
br label %8
38: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [1000000 x i32]
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = add nsw i32 %7, -1
store i32 %8, i32* %1
%9 = icmp eq i32 %7, 0
br i1 %9, label %40, label %10
10: ; preds = %0
%11 = bitcast i32* %2 to i8*
%12 = bitcast [1000000 x i32]* %3 to i8*
%13 = bitcast i32* %4 to i8*
br label %14
14: ; preds = %10, %34
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%16 = load i32, i32* %2
%17 = add nsw i32 %16, -1
store i32 %17, i32* %2
%18 = icmp eq i32 %16, 0
br i1 %18, label %34, label %19
19: ; preds = %14, %29
%20 = phi i32 [ %30, %29 ], [ 0, %14 ]
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [1000000 x i32], [1000000 x i32]* %3, i64 0, i64 %23
%25 = load i32, i32* %24
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %19
%28 = add nsw i32 %20, 1
store i32 1, i32* %24
br label %29
29: ; preds = %27, %19
%30 = phi i32 [ %28, %27 ], [ %20, %19 ]
%31 = load i32, i32* %2
%32 = add nsw i32 %31, -1
store i32 %32, i32* %2
%33 = icmp eq i32 %31, 0
br i1 %33, label %34, label %19
34: ; preds = %29, %14
%35 = phi i32 [ 0, %14 ], [ %30, %29 ]
%36 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %1
%38 = add nsw i32 %37, -1
store i32 %38, i32* %1
%39 = icmp eq i32 %37, 0
br i1 %39, label %40, label %14
40: ; preds = %34, %0
ret i32 0
}