Ehab has an array $a$ of length $n$. He has just enough free time to make a new array consisting of $n$ copies of the old array, written back-to-back. What will be the length of the new array's longest increasing subsequence?

A sequence $a$ is a subsequence of an array $b$ if $a$ can be obtained from $b$ by deletion of several (possibly, zero or all) elements. The longest increasing subsequence of an array is the longest subsequence such that its elements are ordered in strictly increasing order.


-----Input-----

The first line contains an integer $t$ — the number of test cases you need to solve. The description of the test cases follows.

The first line of each test case contains an integer $n$ ($1 \le n \le 10^5$) — the number of elements in the array $a$.

The second line contains $n$ space-separated integers $a_1$, $a_2$, $\ldots$, $a_{n}$ ($1 \le a_i \le 10^9$) — the elements of the array $a$.

The sum of $n$ across the test cases doesn't exceed $10^5$.


-----Output-----

For each testcase, output the length of the longest increasing subsequence of $a$ if you concatenate it to itself $n$ times.


-----Example-----
Input
2
3
3 2 1
6
3 1 4 1 5 9

Output
3
5



-----Note-----

In the first sample, the new array is $[3,2,\textbf{1},3,\textbf{2},1,\textbf{3},2,1]$. The longest increasing subsequence is marked in bold.

In the second sample, the longest increasing subsequence will be $[1,3,4,5,9]$.

Difficulty: EASY
Tags: Implementation

Greedy algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
t = int(input())
ans = ''
for i in range(t):
	n = int(input())
	p = sorted([int(j) for j in input().split()])
	k = 0
	for j in range(n - 1):
		if p[j] == p[j + 1]:
			k += 1
		else:
			pass
	ans += str(n - k) + '\n'
print(ans)


for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	print(len(set(arr)))


import sys
n = int(input())
while n > 0:
	n -= 1
	x = int(input())
	y = [int(i) for i in sys.stdin.readline().split()]
	y.sort()
	z = y[0]
	del y[0]
	x -= 1
	per1 = z
	otvet = 1
	while x > 0:
		x -= 1
		z = y[0]
		del y[0]
		per2 = z
		if per1 < per2:
			per1 = per2
			otvet += 1
	print(otvet)


for i in [*open(0)][2::2]:
	print(len(set([*map(int, i.split())])))


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print(1)
		continue
	else:
		a.sort()
		b = set(a)
		print(len(b))


n = int(input())
l = []
string = ''
for _ in range(n):
	input()
	string = input()
	l = string.split(' ')
	l = [int(x) for x in l]
	print(len(set(l)))


import math

def mergeSort(lst):
	if len(lst) <= 1:
		return lst
	mid = math.floor(len(lst) / 2)
	left = mergeSort(lst[0:mid])
	right = mergeSort(lst[mid:])
	return merge(left, right)

def merge(arr1, arr2):
	i = 0
	j = 0
	lst = []
	while i < len(arr1) and j < len(arr2):
		if arr1[i] < arr2[j]:
			lst.append(arr1[i])
			i += 1
		else:
			lst.append(arr2[j])
			j += 1
	while i < len(arr1):
		lst.append(arr1[i])
		i += 1
	while j < len(arr2):
		lst.append(arr2[j])
		j += 1
	return lst
testCase = int(input())
test = 0
while test < testCase:
	num1 = int(input())
	lst = list(map(int, input().split()))
	count = 0
	lst = mergeSort(lst)
	i = 0
	lst = set(lst)
	print(len(lst))
	test += 1


a = int(input())
for x in range(a):
	b = int(input())
	k = list(map(int, input().split()))
	k = list(dict.fromkeys(k))
	print(len(k))


import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
from functools import lru_cache
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

def input():
	return sys.stdin.readline()

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())

def CeilIndex(A, l, r, key):
	while r - l > 1:
		m = l + (r - l) // 2
		if A[m] >= key:
			r = m
		else:
			l = m
	return r

def lis(A, size):
	tailTable = [0 for i in range(size + 1)]
	ln = 0
	tailTable[0] = A[0]
	ln = 1
	for i in range(1, size):
		if A[i] < tailTable[0]:
			tailTable[0] = A[i]
		elif A[i] > tailTable[ln - 1]:
			tailTable[ln] = A[i]
			ln += 1
		else:
			tailTable[CeilIndex(tailTable, -1, ln - 1, A[i])] = A[i]
	return ln
for _ in range(int(input())):
	n = int(input())
	a = list(mapi())
	mp = {}
	res = 0
	for i in a:
		if i not in mp:
			res += 1
			mp[i] = 1
	print(res)


from sys import stdin
a = int(stdin.readline())
for k in range(0, a):
	b = int(stdin.readline())
	c = stdin.readline().split()
	d = set(c)
	e = len(d)
	print(e)


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		N = int(input())
		A = [int(x) for x in input().split()]
		print(len(list(set(A))))
main()


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	print(len(set(A)))


from sys import stdin
input = stdin.readline
import math
for i in range(int(input())):
	n = int(input())
	arr = sorted(list(map(int, input().split())))
	ans = n
	for j in range(n - 1):
		if arr[j + 1] == arr[j]:
			ans -= 1
	print(ans)


import sys
T = int(sys.stdin.readline())
for i in range(T):
	N = int(sys.stdin.readline())
	nums = list(map(int, sys.stdin.readline().split()))
	print(len(set(nums)))


t = int(input())
for x in range(t):
	length = int(input())
	arr = [int(j) for j in input().split()]
	arr = set(arr)
	print(len(arr))


for _ in range(int(input())):
	n = int(input())
	print(len(set(map(int, input().split()))))


t = int(input())
for i in range(t):
	n = int(input())
	a = input().split()
	s_a = set(a)
	print(f'{len(s_a)}\n')


from collections import OrderedDict
t = int(input())
while t > 0:
	n = int(input())
	li = [int(ele) for ele in input().split()]
	li = list(OrderedDict.fromkeys(li))
	print(len(li))
	t -= 1


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))
k = inp()
for i in range(k):
	count = 0
	n = inp()
	l = inlt()
	print(len(list(set(l))))


for s in [*open(0)][2::2]:
	l = list(map(int, s.split()))
	l = len(set(l))
	print(l)


from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
for _ in range(val()):
	n = val()
	l = sorted(li())
	ans = 1
	for i in range(1, n):
		if l[i] > l[i - 1]:
			ans += 1
	print(ans)


for i in range(int(input())):
	n = int(input())
	ls = sorted(list(map(int, input().split())))
	kq = n
	for i in range(1, n):
		if ls[i] == ls[i - 1]:
			kq -= 1
	print(kq)


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	st = set(map(int, sys.stdin.readline().split()))
	print(len(st))


t = int(input())
k = []
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	k.append(len(set(a)))
for i in k:
	print(i)


for _ in range(int(input())):
	size = input()
	print(len(set(input().split())))


t = int(input())
for io in range(t):
	n = int(input())
	arr = len(set(map(int, input().split())))
	print(arr)


for i in range(int(input())):
	input()
	print(len(set(map(int, input().split()))))


for i in range(int(input())):
	n = int(input())
	mp = set()
	arr = [int(a) for a in input().split()]
	for a in arr:
		mp.add(a)
	print(len(mp))


t = int(input())
for i in range(t):
	n = int(input())
	a = {int(x) for x in input().split()}
	print(len(a))


from sys import stdin, stdout
t = int(input())
for _ in range(t):
	n = int(stdin.readline())
	l = [int(i) for i in stdin.readline().split()]
	stdout.write(str(len(set(l))) + '\n')


for _ in range(int(input())):
	x = int(input())
	a = list(map(int, input().split()))
	print(len(set(a)))


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	d = set(a)
	print(len(d))


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	li_set = set(li)
	print(len(li_set))


for i in range(int(input())):
	p = int(input())
	r = list(map(int, input().split()))
	m = list(dict.fromkeys(r))
	print(len(m))


n = int(input())
l = []
m = []
nn = []
s = set()
for _ in range(n):
	input()
	string = input()
	l = string.split(' ')
	for k in l:
		m.append(int(k))
	print(len(set(m)))
	m = []


t = int(input())
for _ in range(0, t):
	n = input()
	a = set(input().split())
	print(len(a))


ans = []
for _ in range(int(input())):
	input()
	ans.append(str(len(set(input().split()))))
print('\n'.join(ans))


n = int(input())
for i in range(n):
	input()
	print(len(set(input().split())))


def main():
	for _ in range(int(input())):
		n = int(input())
		setA = set(map(int, input().split()))
		print(len(setA))
main()


cin = input('')
cin = cin.strip().split()
n = int(cin[0])
count = 0
for i in range(n):
	cin1 = input('')
	cin2 = input('')
	d = {}
	arr = list(map(int, cin2.rstrip().split()))
	for i in range(int(cin1)):
		if arr[i] in d:
			d[arr[i]] += 1
		else:
			d[arr[i]] = 1
	print(len(d))


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	li = list(map(int, input().split(' ')))
	se = set(li)
	print(len(se))


t = int(input())
for case_num in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	print(len(set(a)))


t = int(input())
for _ in range(t):
	input()
	nums = map(int, input().split())
	print(len(set(nums)))


t = int(input())
out = []
for i in range(0, t):
	n = int(input())
	lis = list(map(int, input().split(' ')))
	lis2 = set(lis)
	lis2 = list(lis2)
	out.append(len(lis2))
for k in out:
	print(k)


for i in range(int(input())):
	n = int(input())
	a = set(map(int, input().split()))
	print(len(a))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s = set(l)
	o = list(s)
	o.sort()
	print(len(o))


import sys
input = sys.stdin.readline
output = sys.stdout.write

def main():
	tests = int(input().rstrip())
	for i in range(tests):
		input()
		nums = set(map(int, input().rstrip().split()))
		ans = str(len(nums))
		output(ans)
		output('\n')
main()


t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split()))
	a = list(dict.fromkeys(a))
	print(len(a))
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	set_ = set(a)
	print(len(set_))


import sys, math, itertools
wtf = sys.stdin.read()
wtf = wtf.strip().split('\n')
for t in [wtf[i:i + 2] for i in range(1, len(wtf), 2)]:
	n = int(t[0])
	A = set(map(int, t[1].split()))
	print(len(A))


for x in range(int(input())):
	input()
	print(len(set(input().split())))


t = int(input())
while t:
	n = int(input())
	l = input().split()
	l = set(l)
	m = len(l)
	print(m)
	t -= 1


for i in range(int(input())):
	a = int(input())
	b = input().split()
	b = set(b)
	print(len(b))


def copy(values):
	result = len(set(values))
	return result
t = int(input())
for i in range(t):
	n = int(input())
	values = list(map(int, input().split()))
	print(copy(values))


import queue
import math
t = int(input())
while t:
	n = int(input())
	a = input().split()
	a = set(map(int, a))
	print(len(a))
	t -= 1


import sys

def main():
	t = int(sys.stdin.readline())
	count = {}
	for i in range(t):
		sys.stdin.readline()
		ans = set(map(int, sys.stdin.readline().split()))
		sys.stdout.write(f'{len(ans)}\n')
main()


import sys
import heapq
input = sys.stdin.readline
from collections import Counter, defaultdict

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def main():
	length = inp()
	array = inlt()
	print(len(set(array)))
t = inp()
for _ in range(t):
	main()


a = input()
for i in range(int(a)):
	x = int(input())
	l = input().split()
	print(len(set(l)))


t = int(input())
for i in range(t):
	n = int(input())
	a = input().split()
	print(len(set(sorted(a))))


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	s = {0}
	for i in range(n):
		s.add(a[i])
	print(len(s) - 1)


import sys
t = int(sys.stdin.readline().strip())
for i in range(0, t):
	len1 = int(sys.stdin.readline().strip())
	array = list(map(int, sys.stdin.readline().strip().split()))
	print(len(set(array)))


n = int(input())
ans = []
for i in range(n):
	m = int(input())
	mimd = [int(j) for j in input().split()]
	mimd = set(mimd)
	mimd = list(mimd)
	ans.append(len(mimd))
for i in ans:
	print(i)


for i in range(int(input())):
	n = input()
	li = list(map(int, input().split()))
	print(len(set(li)))


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
test = inp()
for k in range(test):
	n = inp()
	arr = inlt()
	temp = set(arr)
	print(len(temp))


a = int(input())
for i in range(a):
	o = int(input())
	u = list(map(int, input().split()))
	print(len(set(u)))


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print('1')
	else:
		c = {}
		for x in range(n):
			if a[x] in c:
				c[a[x]] += 1
			else:
				c[a[x]] = 1
		print(len(c))
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	p = set(l)
	print(len(p))


t = int(input())
for i in range(t):
	n = int(input())
	l = [int(i) for i in input().split(' ')]
	l.sort()
	out = list(dict.fromkeys(l))
	print(len(out))


t = int(input())

def copy(lis):
	return len(set(lis))
for i in range(t):
	n = int(input())
	l = input().split()
	li = list(map(int, l))
	print(copy(li))


import sys
t = int(sys.stdin.readline().strip())
for i in range(0, t):
	len = int(sys.stdin.readline().strip())
	array = list(map(int, sys.stdin.readline().strip().split()))
	m = min(array)
	k = 0
	for j in set(array):
		if j != m:
			k += 1
	print(k + 1)


for _ in range(int(input())):
	a = int(input())
	l = set(map(int, input().split()))
	print(len(l))


case = int(input())
for i in range(case):
	l = int(input())
	data = input()
	data = data.split()
	data = [int(x) for x in data]
	data.sort()
	yo = 0
	for i in range(len(data) - 1):
		if data[i] == data[i + 1]:
			continue
		else:
			yo += 1
	print(yo + 1)


for i in range(int(input())):
	k = int(input())
	lst = list(map(int, input().split()))
	lst = set(lst)
	print(len(lst))


t = int(input())
for p in range(0, t):
	q = int(input())
	x = [int(i) for i in input().split()]
	p = set(x)
	print(len(p))


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s = set(l)
	print(len(s))


t = int(input())
answers = []
for i in range(t):
	n = int(input())
	a = set(map(int, input().split(' ')))
	answers.append(len(a))
for answer in answers:
	print(answer)


n = int(input())
for i in range(n):
	k = int(input())
	x = set(map(int, input().split()))
	print(len(x))


test = int(input())
for x in range(test):
	n = int(input())
	l = list(map(int, input().split()))
	print(len(set(l)))


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	l = list(map(int, input().split()))
	print(len(set(l)))


t = int(input())
while t > 0:
	n = int(input())
	li = [int(ele) for ele in input().split()]
	li.sort()
	i = 0
	li = list(set(li))
	print(len(li))
	t -= 1


t = int(input())
for case in range(t):
	n = int(input())
	arr = [int(a) for a in input().split()]
	print(len(set(arr)))


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	ans = len(set(a))
	print(ans)
t = int(input())
for i in range(t):
	solve()


from itertools import product, combinations
from math import sqrt
t = int(input())
for _ in range(t):
	n = int(input())
	A = set()
	arr = list(map(int, input().split()))
	for el in arr:
		A.add(el)
	print(len(A))


def answer():
	n = int(input())
	while n:
		times = int(input())
		a = input().split()
		a = [int(x) for x in a]
		them = len(set(a))
		done = 0
		if them <= times:
			print(them)
			done = 1
		if not done:
			visited = []
			i = 0
			ans = 1
			while i < len(a) and ans < len(a) - len(visited):
				j = i
				temp = 1
				thing = a[j]
				while j < len(a):
					if a[j] > thing:
						visited.append(j)
						thing = a[j]
						temp += 1
					j += 1
				i += 1
				while i in visited:
					i += 1
				if ans < temp:
					ans = temp
			i = 0
			while i + 1 < times and ans < them:
				i += 1
				ans += 1
			print(ans)
		n -= 1
answer()


t = int(input())
for i in range(t):
	fl = 1
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	for i in range(1, len(a)):
		if a[i] != a[i - 1]:
			fl += 1
	print(fl)


for ct in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(len(set(a)))


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = set(list(map(int, input().split())))
	print(len(a))


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	input()
	print(len(set(map(int, input().split()))))


import sys
I = sys.stdin.readline
for _ in range(int(I())):
	n = int(I())
	arr = list(map(int, I().split()))
	arr.sort()
	a = set()
	for i in arr:
		a.add(i)
	print(len(a))


my_value = []
for i in range(int(input())):
	num = int(input())
	lis = set(map(int, input().split()))
	l = len(lis)
	my_value.append(l if num >= l else num)
for i in my_value:
	print(i)


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	s = set()
	ls = list(map(int, input().split()))
	for j in range(len(ls)):
		s.add(ls[j])
	ans.append(len(s))
for i in range(t):
	print(ans[i])


t = int(input())
while t > 0:
	input()
	values = input().rsplit(' ')
	numberset = set(values)
	print(len(numberset))
	t -= 1


def copy():
	a = set(input().split())
	return len(a)
for i in range(int(input())):
	input()
	print(copy())


nTest = int(input())
for i in range(nTest):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 1
	for j in range(1, n):
		if a[j] != a[j - 1]:
			ans = ans + 1
	print(ans)


def longestSequence(arr, n):
	mp = {}
	for i in range(n):
		if arr[i] in mp:
			mp[arr[i]] += 1
		else:
			mp[arr[i]] = 1
	return len(mp)
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	print(longestSequence(arr, n))


t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	A = set(A)
	print(len(A))


for i in range(int(input())):
	n = int(input())
	n1 = list(map(int, input().split()))
	c = list(set(n1))
	print(len(c))


n = int(input())
count = 0
for i in range(0, n):
	x = int(input())
	k = list(map(int, input().split()))
	a = set(k)
	g = len(a)
	print(g)


tests = int(input())
for i in range(tests):
	bla = input()
	nums = set(map(int, input().split()))
	print(len(nums))


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	arr = list(map(int, input().split(' ')))
	m = set(arr)
	print(len(m))


for _ in range(int(input())):
	print(len([set(map(int, input().split())) for i in 'aa'][1]))


for i in range(int(input())):
	n = int(input())
	lst = sorted(list(set(list(map(int, input().split())))))
	print(len(lst))


import sys
from collections import Counter

def main():
	for _ in range(int(sys.stdin.readline())):
		n = int(sys.stdin.readline())
		l = [int(y) for y in sys.stdin.readline().split()]
		d = Counter(l)
		print(len(d))
main()


t = int(input())
while t != 0:
	n = input()
	print(len(set(input().split())))
	t -= 1


for s in [*open(0)][2::2]:
	print(len(set(s.split())))


n = int(input())
count = []
for i in range(0, n):
	n1 = int(input())
	l = []
	l = list(map(int, input().split(' ')[:n1]))
	s = set(l)
	count.append(len(s))
	n1 = 0
for i in range(0, len(count)):
	print(count[i])


t = int(input())
num = list()
array = list()
for j in range(t):
	num.append(int(input()))
	array.append(list(map(int, input().split())))
for j in range(t):
	print(len(set(array[j])))


t = int(input())
for ti in range(1, t + 1):
	n = int(input())
	a = list(map(int, input().split()))
	s = set()
	for num in a:
		s.add(num)
	print(len(s))


for t in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	s = set(arr)
	print(len(s))


t = int(input())
ak = []
for i in range(t):
	n = int(input())
	a = input()
	b = list(map(int, a.split()))
	x = set(b)
	ak.append(len(x))
for k in ak:
	print(k)


res = ''
for _ in range(int(input())):
	n = int(input())
	arr = set(map(int, input().split()))
	res += '%d\n' % len(arr)
print(res)


def calc(a):
	return len(set(a))
N = int(input())
cases = []
for _ in range(N):
	_ = input()
	cases.append(list(map(int, input().split())))
for c in cases:
	print(calc(c))


s = int(input())
for i in range(s):
	b = int(input())
	print(len(set(input().split())))


ncase = int(input())
for i in range(0, ncase):
	arrsize = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	arr.append(-1)
	answer = 0
	for z in range(0, len(arr) - 1):
		if arr[z] != arr[z + 1]:
			answer = answer + 1
	print(answer)


t = int(input())
for _ in range(t):
	s = int(input())
	ar = list(map(int, input().split()))
	print(len(set(sorted(ar))))


t = int(input())
res = []
for i in range(t):
	n = int(input())
	a = set(input().split(' '))
	res.append(len(a))
for i in res:
	print(i)


test = int(input())
for _ in range(test):
	length_of_sequence = int(input())
	sequence = list(map(int, input().split()))
	print(len(set(sequence)))


from sys import stdin
inf = stdin
for qw in range(int(inf.readline())):
	n = int(inf.readline())
	arr = list(map(int, inf.readline().split(' ')))
	print(len(set(arr)))


from sys import stdin, stdout
import math
import heapq
t = 1

def aint():
	return int(input().strip())

def lint():
	return list(map(int, input().split()))

def fint():
	return list(map(int, stdin.readline().split()))

def main():
	n = aint()
	l = lint()
	print(len(set(l)))
t = int(input())
for i in range(t):
	main()


t = input()
for q in range(int(t)):
	x = input()
	s = set(input().split(' '))
	print(len(s))


from sys import stdin, stdout

def main():
	t = int(stdin.readline())
	for tc in range(0, t):
		n = int(stdin.readline())
		a = list(map(int, stdin.readline().rstrip().split()))
		s = set()
		for x in a:
			s.add(x)
		print(len(s))
main()


for nt in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l = set(l)
	l = list(l)
	print(len(l))


m = int(input())
l = []
for i in range(m):
	t = int(input())
	a = input().split()
	l.append(len(set(a)))
for i in l:
	print(i)


final = list()
t = int(input())
for j in range(t):
	n = int(input())
	count = 0
	di = dict()
	data = input()
	for i in data.split():
		di[i] = di.get(i, 0) + 1
	lst = sorted(di.keys())
	l = len(lst)
	final.append(l)
for k in final:
	print(k)


trials = int(input())
ans = []
for i in range(trials):
	n = int(input())
	A = input()
	A = [int(i) for i in A.split()]
	ans.append(len(list(set(A))))
for i in ans:
	print(i)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s = set()
	for i in range(n):
		s.add(a[i])
	print(len(s))


tc = int(input())
while tc:
	n = int(input())
	l = set(map(int, input().split()))
	print(len(l))
	tc -= 1


for _ in [0] * int(input()):
	(n, ans) = (input(), len(set(map(int, input().split()))))
	print(ans)


fptr = open(0)
for _ in range(int(next(fptr))):
	n = int(next(fptr))
	a = set(map(int, next(fptr).split()))
	print(len(a))


import sys
from math import *
from collections import defaultdict
from queue import deque
from heapq import heappush, heappop
lines = [line.strip() for line in sys.stdin.readlines()]
t = int(lines[0])
for tt in range(t):
	n = int(lines[1 + tt * 2])
	xs = list(map(int, lines[2 + tt * 2].split()))
	print(len(set(xs)))


def mysplit(s, a):
	interm = ''
	l = []
	for (loc, i) in enumerate(s):
		if i == a and interm.isnumeric():
			l.append(int(interm))
			interm = ''
		elif i == a and (not interm.isnumeric()):
			interm = ''
		elif i != a:
			interm += i
		if loc == len(s) - 1 and i != a:
			l.append(int(interm))
	return l

def myjoin(l, a):
	output_str = ''
	for (loc, i) in enumerate(l):
		if not loc == len(l) - 1:
			output_str += str(i) + a
	output_str += str(l[len(l) - 1])
	return output_str

def mymerge(l1, l2):
	output_list = []
	(i, j) = (0, 0)
	while i < len(l1) and j < len(l2):
		if l1[i] < l2[j]:
			output_list.append(l1[i])
			i += 1
		else:
			output_list.append(l2[j])
			j += 1
	if i == len(l1):
		output_list += l2[j:]
	elif j == len(l2):
		output_list += l1[i:]
	return output_list

def mysort(l):
	if len(l) < 2:
		return l
	else:
		mid = len(l) // 2
		left = mysort(l[:mid])
		right = mysort(l[mid:])
		return mymerge(left, right)

def not_in_list(n, l):
	for i in l:
		if n == i:
			return False
	return True

def remove_dublicates(l):
	output_list = []
	output_list.append(l[0])
	i = 0
	j = 1
	while i < len(l) and j < len(l):
		if l[i] == l[j]:
			j += 1
		else:
			output_list.append(l[j])
			i = j
			j += 1
	return output_list

def main_function():
	a = input()
	l = []
	for i in range(int(a)):
		b = input()
		c = input()
		c = remove_dublicates(mysort(mysplit(c, ' ')))
		l.append(len(c))
	return myjoin(l, '\n')
print(main_function())


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c = 1
	l1 = list(set(l))
	val = min(l)
	for i in range(len(l1)):
		if val < l1[i]:
			c += 1
	print(c)


import time
import os, sys
from io import BytesIO, IOBase
from types import GeneratorType
from bisect import bisect_left, bisect_right
from collections import defaultdict as dd, deque as dq, Counter as dc
import math, string, heapq as h
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def getInt():
	return int(input())

def getStrs():
	return input().split()

def getInts():
	return list(map(int, input().split()))

def getStr():
	return input()

def listStr():
	return list(input())

def getMat(n):
	return [getInts() for _ in range(n)]

def getBin():
	return list(map(int, list(input())))

def isInt(s):
	return '0' <= s[0] <= '9'

def ceil_(a, b):
	return a // b + (a % b > 0)
MOD = 998244353

def solve():
	N = getInt()
	A = getInts()
	return len(set(A))
for _ in range(getInt()):
	print(solve())


import sys
for t in range(int(sys.stdin.readline())):
	sys.stdin.readline()
	a = set()
	res = 0
	for e in sys.stdin.readline().split():
		if e not in a:
			a.add(e)
	sys.stdout.write('{}\n'.format(len(a)))


import sys

def main():
	t = int(sys.stdin.readline())
	count = {}
	for i in range(t):
		sys.stdin.readline()
		ans = tuple(map(int, sys.stdin.readline().split()))
		for i in ans:
			count[i] = count.get(i, 0) + 1
		sys.stdout.write(f'{len(count)}\n')
		count.clear()
main()


for _ in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	B = set(A)
	ans = len(B)
	print(ans)


t = int(input())
for _ in range(t):
	x = int(input())
	arr = list(map(int, input().split()))
	print(len(set(arr)))


I = input
for _ in range(int(I())):
	I()
	print(len(set(I().split())))


t = int(input())
for i in range(t):
	n = int(input())
	l = [int(s) for s in input().split()]
	print(len(set(l)))


q = int(input())
for i in range(q):
	x = int(input())
	arr = list(map(int, input().split()))
	arr = set(arr)
	print(len(arr))


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	c = 0
	for i in range(1, len(l)):
		if l[i] > l[i - 1]:
			c += 1
	print(c + 1)


n = int(input())
for i in range(n):
	y = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	res = 0
	i = 0
	while i < y:
		while i < y - 1 and arr[i] == arr[i + 1]:
			i += 1
		res += 1
		i += 1
	print(res)


def main(a):
	return len(set(a))
t = int(input())
cases = []
for i in range(t):
	n = int(input())
	cases.append(list(map(int, input().replace(',', ' ').split())))
for case in cases:
	print(main(case))


total = int(input())
for i in range(total):
	n = int(input())
	input_list = input().split()
	counter = 1
	input_list.sort()
	for j in range(n - 1):
		if input_list[j] != input_list[j + 1]:
			counter += 1
	print(counter)


n = int(input())
sol = []
for i in range(n):
	x = input()
	nums = [int(x) for x in input().split()]
	nums = set(nums)
	sol.append(len(nums))
for i in sol:
	print(i)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(len(list(dict.fromkeys(arr))))


list = []
x = int(input())
for a in range(0, x):
	y = int(input())
	list = map(int, input().split())
	b = set(list)
	print(len(b))


n = int(input())
b = []
for i in range(n):
	x = int(input())
	y = list(map(int, input().split()))
	z = set(y)
	b.append(len(z))
for i in b:
	print(i)


for _ in range(int(input())):
	n = int(input())
	seq = list(map(int, input().split()))
	ns = set(seq)
	print(len(ns))


T = int(input())
for t in range(T):
	n = int(input())
	lst = [int(d) for d in input().split()]
	d = {}
	count = 0
	for i in range(len(lst)):
		if lst[i] not in d:
			d[lst[i]] = 1
			count += 1
	print(count)


t = int(input())
while t > 0:
	n = int(input())
	val = input().rsplit()
	arr = set(val)
	print(len(arr))
	t -= 1


for i in [*open(0)][2::2]:
	print(len({*i.split()}))


def func(n):
	for _ in range(n):
		int(input())
		m = list(map(int, input().split()))
		k.append(str(len(set(m))))
	print('\n'.join(k))
k = []
func(int(input()))


n = int(input())
for i in range(n):
	b = input()
	s = set(list(map(int, input().split())))
	print(max(1, len(s)))


x = int(input())
for i in range(0, x):
	s = int(input())
	lst = [int(x) for x in input().split()]
	n = min(lst)
	p = 1
	lst.sort()
	for q in range(s):
		if lst[q] > lst[q - 1]:
			p += 1
	print(p)


for j in range(int(input())):
	n = int(input())
	T = set(input().split())
	print(len(T))


from math import ceil
n = int(input())
for i in range(n):
	t = int(input())
	a = set(list(map(int, input().split())))
	print(len(a))


for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	lst = list(dict.fromkeys(lst))
	print(len(lst))


for b in range(int(input())):
	n = int(input())
	g = i = 0
	x = sorted([int(j) for j in input().split()])
	while n - 1 > i:
		if x[i] == x[i + 1]:
			i += 1
		else:
			g += 1
			i += 1
	g += 1
	print(g)


def longestIncreasingSubsequence(arr):
	return len(set(arr))
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	print(longestIncreasingSubsequence(arr))


import math
t = int(input())
while t > 0:
	a = int(input())
	l = list(map(int, input().split()))
	m = list(dict.fromkeys(l))
	print(len(m))
	t -= 1


s = ''
for i in range(int(input())):
	input()
	s = s + str(len({i for i in input().split()})) + '\n'
print(s)


t = int(input())
A = []
for i in range(t):
	n = int(input())
	a = [int(p) for p in input().split()]
	A.append(a)
for i in range(t):
	arr = A[i]
	print(len(set(arr)))


import sys
t = int(sys.stdin.readline().rstrip())
out = []
while t > 0:
	n = int(sys.stdin.readline().rstrip())
	arr = list(map(int, sys.stdin.readline().rstrip().split(' ')))
	var = len(set(arr))
	out.append(var)
	t = t - 1
for var2 in out:
	print(var2)


def solve():
	n = int(input())
	a = [int(i) for i in input().split()]
	return len(set(a))
t = int(input())
ans = []
while t:
	ans.append(str(solve()))
	t -= 1
print('\n'.join(ans))


for _ in range(int(input())):
	no = int(input())
	print(len(set(input().split())))


for _ in range(int(input())):
	num = int(input())
	li = [int(i) for i in input().split()]
	print(len(set(li)))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = set(a)
	print(len(s))


from bisect import bisect_left as bl, bisect_right as br, insort
import sys
import heapq
from math import *
from collections import defaultdict as dd, deque

def data():
	return sys.stdin.readline().strip()

def mdata():
	return map(int, data().split())
for i in range(int(data())):
	n = int(data())
	A = set(mdata())
	print(len(A))


t = int(input())
while t:
	t = t - 1
	a = int(input())
	a = list(map(int, input().split()))
	d = {}
	b = 0
	for x in a:
		if x in d:
			b = b + 1
		else:
			d[x] = 1
	print(len(a) - b)


test = int(input())
for _ in range(test):
	n = int(input())
	arr = list(map(int, input().split()))
	s = set()
	for i in arr:
		s.add(i)
	print(len(s))


import sys
t = int(sys.stdin.readline().rstrip())
while t > 0:
	n = int(sys.stdin.readline().rstrip())
	arr = list(map(int, sys.stdin.readline().rstrip().split(' ')))
	print(len(set(arr)))
	t = t - 1


try:
	for _ in range(int(input())):
		n = int(input())
		l = list(map(int, input().split()))
		print(len(set(l)))
except:
	pass


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	t = I()
	rr = []
	for _ in range(t):
		n = I()
		a = LI()
		rr.append(len(set(a)))
	return JA(rr, '\n')
print(main())


T = int(input())
for _ in range(T):
	n = int(input())
	arr = list(map(int, input().split()))
	count = 0
	has = set()
	for i in range(n):
		if arr[i] not in has:
			has.add(arr[i])
			count += 1
	print(count)


t = int(input())
s = set()
for _ in range(t):
	input()
	s.update(input().split())
	print(len(s))
	s.clear()


def examA():
	T = I()
	ans = []
	for _ in range(T):
		x = I()
		ans.append([1, x - 1])
	for v in ans:
		print(' '.join(map(str, v)))
	return

def examB():
	T = I()
	ans = []
	for _ in range(T):
		N = I()
		A = LI()
		A = set(A)
		cur = len(A)
		ans.append(cur)
	for v in ans:
		print(v)
	return

def examC():
	T = I()
	ans = []
	for _ in range(T):
		cur = 0
		ans.append(cur)
	for v in ans:
		print(v)
	return

def examD():
	ans = 0
	print(ans)
	return

def examE():
	ans = 0
	print(ans)
	return

def examF():
	ans = 0
	print(ans)
	return
import sys, bisect, itertools, heapq, math, random
from copy import deepcopy
from heapq import heappop, heappush, heapify
from collections import Counter, defaultdict, deque

def I():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LSI():
	return list(map(str, sys.stdin.readline().split()))

def LS():
	return sys.stdin.readline().split()

def SI():
	return sys.stdin.readline().strip()
global mod, mod2, inf, alphabet, _ep
mod = 10 ** 9 + 7
mod2 = 998244353
inf = 10 ** 18
_ep = 10 ** (-12)
alphabet = [chr(ord('a') + i) for i in range(26)]
sys.setrecursionlimit(10 ** 6)
examB()


input = __import__('sys').stdin.readline
print = __import__('sys').stdout.write
for _ in range(int(input())):
	n = int(input())
	l = set(input().split())
	print(str(len(l)) + '\n')


loopcount = int(input())
for loop in range(loopcount):
	a = input()
	x = input()
	x = x.split(' ')
	x = list(map(int, x))
	c = set()
	for i in x:
		c.add(i)
	print(len(c))


def CeilIndex(A, l, r, key):
	while r - l > 1:
		m = l + (r - l) // 2
		if A[m] >= key:
			r = m
		else:
			l = m
	return r

def Lo(A, size):
	tailTable = [0 for i in range(size + 1)]
	len = 0
	tailTable[0] = A[0]
	len = 1
	for i in range(1, size):
		if A[i] < tailTable[0]:
			tailTable[0] = A[i]
		elif A[i] > tailTable[len - 1]:
			tailTable[len] = A[i]
			len += 1
		else:
			tailTable[CeilIndex(tailTable, -1, len - 1, A[i])] = A[i]
	return len
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	x = Lo(a, n)
	print(max(x, 0))


for i in range(int(input())):
	n = int(input())
	ar = sorted(list(map(int, input().split(' '))))
	count = 1
	for j in range(1, n):
		if ar[j] == ar[j - 1]:
			continue
		else:
			count += 1
	print(count)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	visited = {}
	c = 0
	for i in arr:
		if visited.get(i):
			continue
		else:
			visited[i] = 1
			c += 1
	print(c)


def f(A):
	INF = 10 ** 10
	F = [INF] * (len(A) + 1)
	F[0] = -INF
	for i in range(len(A)):
		left = 0
		right = len(A)
		while right - left > 1:
			middle = (left + right) // 2
			if F[middle] >= A[i]:
				right = middle
			else:
				left = middle
		F[right] = A[i]
	return F.index(10 ** 10) - 1
t = int(input())
for i in range(t):
	n = int(input())
	lit = [int(i) for i in input().split()]
	if len(set(lit)) > n:
		print(f(lit) + n - 1)
	else:
		print(len(set(lit)))


t = int(input())
answer = []
while t != 0:
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	l = list(set(a))
	answer.append(len(l))
	t = t - 1
print('\n'.join(map(str, answer)))


import sys

def zap():
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	ans = 0
	cur = 1
	while cur != n:
		if a[cur] == a[cur - 1]:
			ans += 1
		cur += 1
	return n - ans
for __ in range(int(input())):
	print(zap())


n = int(input())
o = []
for i in range(n):
	m = int(input())
	o += [str(len(set(input().split())))]
print('\n'.join(o))


def call():
	n = int(input())
	num = [int(x) for x in input().split()]
	k = list(dict.fromkeys(num))
	print(len(k))
for i in range(int(input())):
	call()


from sys import stdin, stdout
t = int(stdin.readline().strip())
for _ in range(t):
	n = int(stdin.readline().strip())
	a = list(map(int, stdin.readline().strip().split()))
	if n == 1:
		stdout.write('1' + '\n')
	else:
		stdout.write(str(len(set(a))) + '\n')


t = int(input())
for _ in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	a = set(a)
	print(len(a))


import random

def bubble_sort(l):
	for t in range(len(l)):
		for i in range(len(l) - 1):
			if l[i] > l[i + 1]:
				(l[i + 1], l[i]) = l[i:i + 2]
	return l
num_cases = int(input())
for i in range(num_cases):
	n = int(input())
	case = list(map(lambda x: int(x), input().split(' ')))
	prev = case.pop(0)
	count = 1
	unfound = {prev}
	for num in case:
		if num > prev:
			count += 1
			prev = num
			unfound.add(num)
		elif n > 0:
			if num not in unfound:
				unfound.add(num)
				n -= 1
				count += 1
	print(count)


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(j) for j in input().split()]
	b = set(a)
	print(len(b))


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	ans = len(set(l))
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	l = []
	l = list(map(int, input().strip().split()))
	m = []
	m = set(l)
	print(len(m))


from sys import stdin
t = int(input())
o = []
for i in range(t):
	ne = int(input())
	e = [int(x) for x in stdin.readline().split()]
	print(len(set(e)))


def run_arr(arr, num):
	s = set(arr)
	print(min(len(s), num))

def run():
	n = int(input())
	arrs = []
	nums = []
	for _ in range(n):
		nums.append(int(input()))
		arr = list(map(int, input().split()))
		arrs.append(arr)
	for i in range(n):
		run_arr(arrs[i], nums[i])
run()


t = int(input())
for i in range(0, t):
	n = int(input())
	arr = list(map(int, input().strip().split()))
	distinct = set([])
	for i in arr:
		distinct.add(i)
	print(len(distinct))


t = int(input())
for i in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	D = {}
	for i in A:
		D[i] = 1
	print(len(D))


from collections import Counter
t = int(input())
for tests in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	l = len(Counter(a).keys())
	print(l)


t = int(input())
for i in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	vis = {k: False for k in range(n)}
	S = set()
	res = 0
	for i in range(n):
		if arr[i] not in S:
			S.add(arr[i])
			res += 1
	print(res)