copytam-da

Recently, Karan gifted Ayush the latest Copytam Da's keyboard. He also gifted him an array of N distinct numbers.

The keyboard allows to you to copy any contiguous subsequence of the array and paste it in any position of the array.

After going back to his room, Ayush used this keyboard on the array. After using it for some time, he realized that he has messed up the original given array. Can you help him find the number of elements in the original array?

Input

The first line contains T, the number of test cases. The description of T test cases follows.
Each test case contains 2 lines. The first line contains N, the number of elements in the messed-up array. The second line contains N space separated integers denoting the elements of the messed up array.

Output

For each test case, output a single line containing the answer.

Constraints

1 ≤  T  ≤ 10

1 ≤  N  ≤ 10^6

1 ≤ A[i] ≤ 10000

SAMPLE INPUT
2
5
1 1 1 1 1
5
1 2 3 1 2

SAMPLE OUTPUT
1
3

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
t=int(input())
while t>0:
	t-=1
	items=set()
	x=[]
	n=int(input())
	y=input()
	x=y.split()
	for p in x:
		items.add(int(p))
	print(len(items))	


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


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
t = eval(input())
while t>0:
	n=eval(input())
	x = input()
	x = x.split()
	y = set(x)
	print(len(y))
	t=t-1


t=eval(input())
if t>=1 and t<=10:
	for i in range(0,t):
		n=eval(input())
		k=0
		if n>=1 and n<=pow(10,6):
			s=input()
			s2=s.split()
			if len(s.split())==n:
				for j in range(0,len(s2)):
					if int(s2[j])<1 and int(s2[j])>1000:
						k+=1
						break
				if k==0:
					c=0
					for j in range(0,len(s)):
						if s[j]!=' ':
							c+=1
							s=s.replace(s[j]," ")
					print(c)
					
						
					
				
			
		


for _ in range(eval(input())):
	c=0
	x=eval(input())
	y=list(map(int,input().split()))
	while len(y)>0:
		a=y[0]
		for i in range(y.count(a)):
			y.remove(a)
		c+=1
	print(c)

	


t = eval(input())

assert(t>=1 and t<=10)

for i in range(t):
	n = eval(input())
	assert(n>=1 and n<= 10**6)
	arr = list(map(int, list(input().strip().split(' '))))
	arr = sorted(arr)
	count = 1
	for i in range(len(arr)-1):
		if arr[i] != arr[i+1]:
			count+= 1
	print(count)


import sys
for i in range(int(eval(input()))):
	n=int(eval(input()))
	messed_array=list(map(int,sys.stdin.readline().split()))
	new=[]
	for element in messed_array:
		if (element not in new):
			new.append(element)
	print((len(new)))
			


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