You have N cards placed in front of you on the table. The i^{th} card has the number A_{i} written on it. 

In one move, you can remove any one card from the remaining cards on the table. 

Find the minimum number of moves required so that all the cards remaining on the table have the same number written on them.

------ Input Format ------ 

- The first line contains a single integer T — the number of test cases. Then the test cases follow.
- The first line of each test case contains an integer N — the number of cards on the table.
- The second line of each test case contains N space-separated integers A_{1}, A_{2}, \dots, A_{N} where A_{i} is the number written on the i^{th} card.

------ Output Format ------ 

For each test case, output the minimum number of moves required so that all the cards remaining on the table have the same number written on them.

------ Constraints ------ 

$1 ≤ T ≤ 100$
$1 ≤N ≤100$
$1 ≤A_{i} ≤10$

----- Sample Input 1 ------ 
3
5
1 1 2 2 3
4
8 8 8 8
6
5 6 7 8 9 10

----- Sample Output 1 ------ 
3
0
5

----- explanation 1 ------ 
Test case $1$: The minimum number of moves required such that all remaining cards have same values is $3$:
- Move $1$: Remove a card with number $1$. Remaining cards are $[1, 2, 2, 3]$.
- Move $2$: Remove a card with number $1$. Remaining cards are $[2, 2, 3]$.
- Move $3$: Remove a card with number $3$. Remaining cards are $[2, 2]$.

Test case $2$: All cards have the same number initially. Thus, no moves are required.

Test case $3$: The minimum number of moves required such that all remaining cards have same values is $5$:
- Move $1$: Remove a card with number $5$. Remaining cards are $[6, 7, 8, 9, 10]$.
- Move $2$: Remove a card with number $6$. Remaining cards are $[7, 8, 9, 10]$.
- Move $3$: Remove a card with number $7$. Remaining cards are $[8, 9, 10]$.
- Move $4$: Remove a card with number $8$. Remaining cards are $[9, 10]$.
- Move $5$: Remove a card with number $9$. Remaining cards are $[10]$.

Source: codechef | Difficulty: EASY


Solutions:
from collections import Counter
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = Counter(a)
	maximum = 0
	for i in d:
		if maximum < d[i]:
			maximum = d[i]
	print(n - maximum)


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	print(n - max(list(map(lambda x: l.count(x), l))))


from statistics import mode
Test = int(input())
for Cases in range(Test):
	NumberofCards = int(input())
	Cards = list(map(int, input().split()))
	Mode = mode(Cards)
	Count = Cards.count(Mode)
	print(NumberofCards - Count)


for _ in range(int(input())):
	a = int(input())
	l1 = list(map(int, input().split()))
	l = len(set(l1))
	c = 0
	if l == a:
		print(l - 1)
	elif l == 1:
		print(0)
	else:
		for i in l1:
			if c < l1.count(i):
				c = l1.count(i)
		print(a - c)


from statistics import mode
for _ in range(int(input())):
	n = int(input())
	k = list(map(int, input().split()))
	j = mode(k)
	cn = k.count(j)
	print(n - cn)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l1 = []
	for i in l:
		l1.append(l.count(i))
	print(len(l) - max(l1))


t = int(input())
for i in range(t):
	n = int(input())
	x = list(map(int, input().split()))
	c = 0
	for i in x:
		if x.count(i) > c:
			c = x.count(i)
	print(n - c)


from collections import Counter
for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))[:n]
	c = Counter(l)
	m = max(c, key=c.get)
	print(n - l.count(m))


for _ in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split()]
	se = set(l)
	c = []
	for i in se:
		cn = 0
		for j in l:
			if int(j) == int(i):
				cn += 1
		c.append(cn)
	print(n - max(c))


for i in range(int(input())):
	c = int(input())
	l = input().split()
	g = []
	dic = {}
	for j in l:
		dic[j] = l.count(j)
	maxi = 0
	for (key, value) in dic.items():
		if value > maxi:
			maxi = value
	print(len(l) - maxi)


for _ in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split()]
	s = set(l)
	cl = []
	for i in s:
		cn = 0
		for j in l:
			if int(j) == int(i):
				cn += 1
		cl.append(cn)
	print(n - max(cl))


from collections import Counter
for i in range(int(input())):
	a = int(input())
	l = list(map(int, input().split()))
	b = Counter(l)
	d = max(b.values())
	print(a - d)


t = int(input())
for i in range(0, t):
	n = int(input())
	m = []
	l = list(map(int, input().split(' ')))
	for i in l:
		m.append(l.count(i))
	print(n - max(m))


from collections import Counter
for i in range(int(input())):
	N = int(input())
	A = list(map(int, input().split()))
	c = Counter(A)
	m = max(c.values())
	print(N - m)


t = int(input())

def ans():
	n = int(input())
	c = 0
	x = [int(i) for i in input().split()]
	for i in x:
		if x.count(i) > c:
			c = x.count(i)
	print(n - c)
for i in range(t):
	ans()


import statistics
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	card = l.count(statistics.mode(l))
	print(n - card)


from statistics import mode
for _ in range(int(input())):
	n = int(input())
	i = list(map(int, input().split()))
	x = mode(i)
	y = i.count(x)
	print(n - y)


for i in range(int(input())):
	N = int(input())
	W = list(map(int, input().split()))
	a = set(W)
	c = []
	for item in a:
		c.append(W.count(item))
	count = 0
	for j in range(len(c)):
		if len(c) > 1:
			a = min(c)
			count = count + a
			c.remove(a)
	print(count)


for i in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	a = lst.count(10)
	b = lst.count(1)
	c = lst.count(2)
	d = lst.count(3)
	e = lst.count(4)
	f = lst.count(5)
	g = lst.count(6)
	h = lst.count(7)
	i = lst.count(8)
	j = lst.count(9)
	max1 = max(a, b, c, d, e, f, g, h, i, j)
	print(len(lst) - max1)


from statistics import mode
t = int(input())
for i in range(t):
	x = int(input())
	n = list(map(int, input().split()))
	f = mode(n)
	fx = n.count(f)
	print(x - fx)


t = int(input())
for _ in range(t):
	n = int(input())
	cards = list(map(int, input().split()))
	freq = {}
	for card in cards:
		freq[card] = freq.get(card, 0) + 1
	max_freq = max(freq.values())
	moves = n - max_freq
	print(moves)


for i in range(int(input())):
	n = int(input())
	a = input().split()
	b = []
	for i in a:
		b.append(a.count(i))
	print(n - max(b))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	freq = {}
	for num in a:
		freq[num] = freq.get(num, 0) + 1
	max_freq = max(freq.values())
	ans = n - max_freq
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	c1 = 0
	for _ in lst:
		c = lst.count(_)
		if c >= c1:
			c1 = c
	print(n - c1)


from statistics import mode
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	m = set(l)
	a = mode(l)
	z = l.count(a)
	print(n - z)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	max = a.count(a[0])
	for i in a:
		if max < a.count(i):
			max = a.count(i)
	print(n - max)


for _ in range(int(input())):
	n = int(input())
	input_1 = list(map(int, input().split(' ')))
	dict_1 = dict()
	for ele in input_1:
		if dict_1.get(ele) == None:
			dict_1[ele] = 1
		else:
			dict_1[ele] = dict_1[ele] + 1
	max_value = 0
	max_key = 0
	for (key, value) in dict_1.items():
		if value > max_value:
			max_value = value
			max_key = key
	print(n - max_value)


for _ in range(int(input())):
	cards = int(input())
	card = list(map(int, input().split()))
	a = set(card)
	maxi = 0
	for q in a:
		if card.count(q) > maxi:
			maxi = card.count(q)
	print(len(card) - maxi)


for _ in range(int(input())):
	n = int(input())
	m = 1
	l = list(map(int, input().split()))
	for i in l:
		x = l.count(i)
		m = max(m, x)
	print(n - m)


from collections import Counter
cases = int(input())
for i in range(cases):
	n = int(input())
	arr = list(map(int, input().split()))
	cnt = Counter(arr).most_common(1)[0][1]
	for a in range(len(arr)):
		if a >= len(arr):
			break
		if cnt <= arr.count(arr[a]):
			cnt = arr.count(arr[a]) + 1
			arr = list(filter(arr[a].__ne__, arr))
	print(len(arr))


for _ in range(int(input())):
	n = int(input())
	num = list(map(int, input().split()))
	l = []
	count = 0
	c = 0
	for i in num:
		c = num.count(i)
		l.append(c)
	print(n - max(l))


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	c1 = 0
	for i in range(n):
		c2 = a.count(a[i])
		if c2 > c1:
			c1 = c2
	print(n - c1)


for i in range(int(input())):
	N = int(input())
	li = list(map(int, input().split()))
	s = set(li)
	count = 0
	for i in s:
		if li.count(i) > count:
			count = li.count(i)
	print(N - count)


n = int(input())
for i in range(n):
	size = int(input())
	K = [0] * 11
	L = list(map(int, input().split()))
	for i in L:
		K[i] += 1
	print(abs(max(K) - size))


t = int(input())
while t:
	n = int(input())
	arr = list(map(int, input().split()))
	count = sum(sorted([arr.count(i) for i in set(arr)])[:-1])
	print(count)
	t -= 1


m = int(input())
l = []
a = 0
for i in range(m):
	x = int(input())
	l = list(map(int, input().strip().split()))[:x]
	n = set(l)
	m = 0
	for i in n:
		if m < l.count(i):
			m = l.count(i)
		else:
			continue
	print(int(len(l) - m))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c = 0
	for i in set(l):
		if l.count(i) > c:
			c = l.count(i)
	print(n - c)


t = int(input())
for i in range(t):
	x = int(input())
	list1 = [int(k) for k in input().split()]
	count = 0
	maxi = 0
	set1 = set(list1)
	for j in set1:
		count = list1.count(j)
		if count > maxi:
			maxi = count
	print(x - maxi)


for t in range(int(input())):
	n = int(input())
	a = input().split()
	uni = {}
	for i in a:
		if i in uni:
			uni[i] += 1
		else:
			uni[i] = 1
	print(n - max(uni.values()))


for _ in range(int(input())):
	m = int(input())
	t = list(map(int, input().split()))
	d = {}
	for i in t:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	min_freq = 0
	for i in d:
		if d[i] > min_freq:
			min_freq = d[i]
	print(m - min_freq)


for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	s = set(x)
	l = []
	for j in s:
		a = x.count(j)
		l.append(a)
	print(n - max(l))


n = int(input())
for i in range(n):
	a = int(input())
	b = list(map(int, input().split()))
	c = [0] * 11
	for j in b:
		c[j] += 1
	max_c = max(c)
	print(a - max_c)


from collections import Counter
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	dic = Counter(l)
	k = max(dic.values())
	print(n - k)


T = int(input())
for _ in range(T):
	N = int(input())
	string = list(map(int, input().split()))
	set_cards = set(string)
	set_cards = list(set_cards)
	max_count = 0
	for i in set_cards:
		count = string.count(i)
		max_count = max(max_count, count)
	print(N - max_count)


import statistics
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	card = a.count(statistics.mode(a))
	print(n - card)


for j in range(int(input())):
	n = int(input())
	h = {}
	l = map(int, input().split())
	for i in l:
		if i not in h:
			h[i] = 1
		else:
			h[i] += 1
	c = max(h.values())
	print(n - c)


t = int(input())
while t > 0:
	count = 0
	flag = 0
	t = t - 1
	n = int(input())
	arr = [n]
	arr = list(map(int, input().strip().split()))[:n]
	d = {}
	m = 0
	for i in arr:
		if i in d.keys():
			d[i] += 1
		else:
			d[i] = 1
	if len(d) == 1:
		count = 0
	else:
		for j in d:
			if m < d[j]:
				m = d[j]
		count = n - m
	print(count)