Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. 
After a long time, Chef has finally decided to renovate his house. Chef's house has N rooms in it numbered from 1 to N. Each room is currently painted in one of the red, blue or green colors. Your are given configuration of colors of his house by a string S consisting of N characters. In this string, color red will be denoted by 'R', green by 'G' and blue by 'B'.

Chef does not like current painting configuration that much and would like to repaint the house such that each room has same color. 
For painting, Chef has all the 3 color paints available and mixing any 2 color paints will result into 3rd color paint i.e
R + B = G
B + G = R
G + R = B
 
For example, painting a room having red color before with green color paint will make the color of room blue.

Also, Chef has many buckets of paint of each color. Simply put, you can assume that he will not run out of paint.

Being extraordinary lazy, our little chef does not want to work much and therefore, he has asked you to find the minimum number of rooms he has to repaint (possibly zero) in order to have all the rooms with same color. Can you please help him?

------ Input ------ 

First line of input contains a single integer T denoting the number of test cases. First line of each test case contains an integer N denoting the number of rooms in the chef's house. Next line of each test case contains a string S denoting the current color configuration of rooms.

------ Output ------ 

For each test case, Print the minimum number of rooms need to be painted in order to have all the rooms painted with same color i.e either red, blue or green.

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

1 ≤ T ≤ 10

1 ≤ N ≤ 10^{5}

S_{i} = {'R','G','B'}

------ Scoring ------ 

$Subtask 1 (40 points) : 1 ≤ N ≤ 10 $
$Subtask 2 (60 points) : original constraints$

----- Sample Input 1 ------ 
3
3
RGR
3
RRR
3
RGB
----- Sample Output 1 ------ 
1
0
2
----- explanation 1 ------ 
Test 1: Chef prefers to paint room 2 with blue color such that the resulting color will be red and all the rooms have same color i.e red.
Test 2: Given configuration has all the rooms painted with red color and therefore, chef does not need to do painting work at all.
Test 3: One possible way of renovation is to paint room 1 with green color, room 2 with red color such that all rooms have same color i.e blue.

Difficulty: EASY

Solutions:
t = int(input())
while t:
	n = int(input())
	s = input()
	r = s.count('R')
	g = s.count('G')
	b = s.count('B')
	sm = max(max(r, g), b)
	print(n - sm)
	t -= 1


for i in range(int(input())):
	n = int(input())
	s = input()
	d = {'R': 0, 'G': 0, 'B': 0}
	for i in s:
		d[i] += 1
	m = 0
	for i in d:
		if d[i] > m:
			m = d[i]
	print(n - m)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	rgb = [s.count('R'), s.count('G'), s.count('B')]
	print(n - max(rgb))


for _ in range(int(input())):
	n = int(input())
	l = list(input())
	m = ['R', 'G', 'B']
	k = []
	for i in m:
		if i in l:
			k.append(l.count(i))
		else:
			k.append(0)
	k.sort()
	print(sum(k[:2]))


for i in range(int(input())):
	n = int(input())
	s = input()
	a = max(s.count('G'), s.count('R'), s.count('B'))
	print(n - a)


n = int(input())

def maxCount(inp):
	R = inp.count('R')
	G = inp.count('G')
	B = inp.count('B')
	if R >= G and R >= B:
		print(G + B)
	elif G >= B and G >= R:
		print(B + R)
	elif B >= R and B >= G:
		print(R + G)
for i in range(n):
	t = int(input())
	inp = input().strip()
	maxCount(inp)


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	x = max(s.count('R'), s.count('G'), s.count('B'))
	print(n - x)


t = int(input())
for i in range(t):
	k = int(input())
	l = list(str(input()))
	count1 = l.count('R')
	count2 = l.count('G')
	count3 = l.count('B')
	if count1 >= count2 and count1 >= count3:
		print(k - count1)
	elif count2 >= count3:
		print(k - count2)
	else:
		print(k - count3)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(input())
	r = 0
	g = 0
	b = 0
	for j in arr:
		if j == 'R':
			r += 1
		elif j == 'G':
			g += 1
		else:
			b += 1
	print(n - max(r, g, b))


t = int(input())
for dummy in range(t):
	n = int(input())
	s = input()
	c = [s.count('R'), s.count('G'), s.count('B')]
	c.sort()
	print(sum(c[0:2]))


n = int(input())
for i in range(1, n + 1):
	s = int(input())
	c = 0
	z = input()
	k = max(z.count('R'), z.count('G'), z.count('B'))
	print(s - k)


for i in range(int(input())):
	n = int(input())
	s = input()
	s1 = set(s)
	l = []
	for i in s1:
		l.append(s.count(i))
	print(n - max(l))


from collections import Counter
for t in range(int(input())):
	n = int(input())
	s = input()
	color = Counter(s)
	(_, num) = color.most_common()[0]
	print(n - num)


for _ in range(int(input())):
	n = int(input())
	s = input().upper()
	r = s.count('R')
	g = s.count('G')
	b = s.count('B')
	print(n - max(r, g, b))


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	(R, G, B) = (0, 0, 0)
	for x in range(n):
		if s[x] == 'R':
			R += 1
		elif s[x] == 'G':
			G += 1
		elif s[x] == 'B':
			B += 1
	if R > G and R > B:
		print(n - R)
	elif G > B:
		print(n - G)
	else:
		print(n - B)


T = int(input())
for _ in range(T):
	n = int(input())
	col = input()
	m = max(col.count('R'), col.count('G'), col.count('B'))
	print(n - m)


from collections import Counter
for i in range(int(input())):
	n = int(input())
	s = input()
	s1 = Counter(s)
	print(n - s1.most_common()[0][1])


T = int(input())
for _ in range(T):
	n = int(input())
	s = input()
	r = 0
	for i in set(s):
		x = s.count(i)
		if x > r:
			r = x
	print(str(n - r))


for i in range(int(input())):
	S = int(input())
	C = input()
	count = 0
	c = set(C)
	for i in c:
		if C.count(i) > count:
			count = C.count(i)
		if count == len(C):
			break
	print(S - count)


for _ in range(int(input())):
	n = int(input())
	s = input()
	(r, g, b) = (0, 0, 0)
	for x in s:
		if x == 'R':
			r += 1
		elif x == 'G':
			g += 1
		else:
			b += 1
	print(n - max(r, g, b))


t = int(input())
for ni in range(t):
	n = int(input())
	s = input()
	sr = s.count('R')
	sg = s.count('G')
	sb = s.count('B')
	smax = max(sr, sg, sb)
	print(n - smax)


t = int(input())
for i in range(t):
	n = int(input())
	z = input()
	m = max(z.count('R'), z.count('G'), z.count('B'))
	print(n - m)


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	r = 0
	g = 0
	b = 0
	for j in s:
		if j == 'R':
			r += 1
		elif j == 'G':
			g += 1
		else:
			b += 1
	temp = max(r, g, b)
	print(r + g + b - temp)


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	(r, g, b) = (0, 0, 0)
	for x in s:
		if x == 'R':
			r += 1
		elif x == 'G':
			g += 1
		else:
			b += 1
	m = max(r, g, b)
	print(len(s) - m)


t = int(input())
for k in range(t):
	n = int(input())
	a = list(str(input()))
	b = []
	b.append(a.count('R'))
	b.append(a.count('G'))
	b.append(a.count('B'))
	c = max(b)
	print(n - c)


t = int(input())
while t:
	N = int(input())
	col = list(input())
	r = col.count('R')
	g = col.count('G')
	b = col.count('B')
	s = max(r, g, b)
	print(N - s)
	t = t - 1


for i in range(int(input())):
	n = int(input())
	s = input()
	x = s.count('R')
	y = s.count('G')
	z = s.count('B')
	print(n - max(x, y, z))


for _ in range(int(input())):
	n = int(input())
	s = input()
	dic = {}
	for i in s:
		dic[i] = 0
	for i in s:
		dic[i] += 1
	maxy = max(list(dic.values()))
	print(n - maxy)


from collections import Counter
T = int(input())
r = []
for _ in range(T):
	input()
	r.append(input())
for i in r:
	c = Counter(i)
	ch = max(c, key=c.get)
	print(len(i) - c[ch])


t = int(input())
for i in range(t):
	n = int(input())
	s = list(str(input()))
	count1 = s.count('R')
	count2 = s.count('G')
	count3 = s.count('B')
	if count1 >= count2 and count1 >= count3:
		print(n - count1)
	elif count2 >= count3:
		print(n - count2)
	else:
		print(n - count3)


t = int(input())
for tc in range(t):
	n = int(input())
	s = input()
	a = max(s.count('G'), s.count('R'), s.count('B'))
	print(n - a)


from statistics import mode
for _ in range(int(input())):
	r = int(input())
	s = input()
	mo = mode(s)
	if s.count(mo) > 1:
		print(r - s.count(mo))
	else:
		print(r - 1)


for __ in range(int(input())):
	walls = int(input())
	s = input()
	R = len(s) - len(s.replace('R', ''))
	G = len(s) - len(s.replace('G', ''))
	B = len(s) - len(s.replace('B', ''))
	L = [R, G, B]
	L.sort()
	print(L[0] + L[1])


for i in range(int(input())):
	n = int(input())
	s = list(input().upper())
	a = set(s)
	count = []
	for j in a:
		sum = 0
		for k in s:
			if j == k:
				sum += 1
			count.append(sum)
	print(n - max(count))


for _ in range(int(input(''))):
	n = int(input(''))
	r = g = b = 0
	c = input()
	for i in c:
		if i == 'R':
			r += 1
		elif i == 'G':
			g += 1
		elif i == 'B':
			b += 1
	m = max(r, g, b)
	print(n - m)


for i in range(int(input())):
	n = int(input())
	color = list(input())
	s = set(color)
	count = 0
	for j in s:
		if color.count(j) > count:
			count = color.count(j)
	print(n - count)


t = int(input())
for _ in range(t):
	n = int(input())
	colors = input()
	count_r = 0
	count_b = 0
	count_g = 0
	for i in range(n):
		if colors[i] == 'R':
			count_r += 1
		elif colors[i] == 'G':
			count_g += 1
		else:
			count_b += 1
	print(n - max(count_b, count_g, count_r))


import sys
for i in range(int(sys.stdin.readline())):
	r = 0
	n = int(sys.stdin.readline())
	s = sys.stdin.readline()
	for i in set(s):
		x = s.count(i)
		if x > r:
			r = x
	sys.stdout.write(str(n - r) + '\n')


T = int(input())
for i in range(T):
	N = int(input())
	S = input()
	r = S.count('R')
	b = S.count('B')
	g = S.count('G')
	l = len(S)
	print(l - max(r, b, g))


for nt in range(int(input())):
	(nc, sc, rc, gc, bc) = (int(input()), input(), 0, 0, 0)
	for i in sc:
		if i == 'R':
			rc += 1
		elif i == 'G':
			gc += 1
		elif i == 'B':
			bc += 1
	print(nc - max(rc, gc, bc))


for _ in range(int(input())):
	n = int(input())
	s = input().lower()
	(r, g, b) = (0, 0, 0)
	for i in s:
		if i == 'r':
			r += 1
		elif i == 'g':
			g += 1
		else:
			b += 1
	c = max([r, g, b])
	print(n - c)


t = input()
for c in range(0, int(t)):
	n = input()
	s = input()
	colors = []
	colors.append(0)
	colors.append(0)
	colors.append(0)
	for x in range(0, int(n)):
		if s[x] == 'R':
			colors[0] += 1
		elif s[x] == 'G':
			colors[1] += 1
		else:
			colors[2] += 1
	print(int(n) - max(colors))


for i in range(int(input())):
	n = int(input())
	s = input()
	r = s.count('R')
	g = s.count('G')
	b = s.count('B')
	maximum = max(r, g, b)
	if maximum == n:
		print(0)
	else:
		print(n - maximum)


for i in range(int(input())):
	a = int(input())
	s = input()
	x = 0
	for i in set(s):
		x = max(x, s.count(i))
	print(a - x)


from collections import Counter
for i in range(int(input())):
	n = int(input())
	s = input()
	c = Counter(s)
	l = []
	for i in c.values():
		l.append(i)
	print(n - max(l))


t = int(input())
while t > 0:
	n = int(input())
	s = input()
	x = s.count('R')
	y = s.count('B')
	z = s.count('G')
	a = max(x, y, z)
	print(n - a)
	t = t - 1


T = int(input())
for i in range(T):
	N = int(input())
	s = input()
	c1 = s.count('R')
	c2 = s.count('G')
	c3 = s.count('B')
	m = max(max(c1, c2), c3)
	M = len(s) - m
	print(M)


T = int(input())
for i in range(T):
	N = int(input())
	S = list(input())
	final = []
	for i in ['R', 'G', 'B']:
		a = S.count(i)
		final.append(a)
	print(N - max(final))


for _ in range(int(input())):
	n = int(input())
	s = list(input())
	x = s.count('R')
	y = s.count('G')
	z = s.count('B')
	k = max(x, y, z)
	print(n - k)


from statistics import mode
for _ in range(int(input())):
	N = int(input())
	S = input()
	print(N - S.count(mode(S)))


t = int(input())
for i in range(t):
	n = int(input())
	st = input()
	dict = {'R': 0, 'G': 0, 'B': 0}
	for j in st:
		dict[j] += 1
	if max(dict, key=lambda x: dict[x]) == 'R':
		print(dict['G'] + dict['B'])
	elif max(dict, key=lambda x: dict[x]) == 'G':
		print(dict['R'] + dict['B'])
	else:
		print(dict['R'] + dict['G'])


for _ in range(int(input())):
	n = int(input())
	s = input()
	ans = max(s.count('R'), s.count('G'), s.count('B'))
	print(n - ans)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	s = input()
	d = Counter(s)
	print(n - max(d.values()))


for _ in range(int(input())):
	n = int(input())
	s = input()
	d = dict()
	for i in s:
		d[i] = d.get(i, 0) + 1
	print(n - max(d.values()))


from collections import Counter
for i in range(int(input())):
	a = int(input())
	b = list(input())
	c = Counter(b)
	print(a - max(c.values()))


for i in range(int(input())):
	n = int(input())
	s = input()
	l = []
	l.append(s.count('R'))
	l.append(s.count('G'))
	l.append(s.count('B'))
	print(n - max(l))


T = int(input())
for i in range(T):
	N = int(input())
	S = input()
	s = set(S)
	if len(s) == 1:
		print(0)
	elif len(s) == 2:
		c1 = s.pop()
		c2 = s.pop()
		print(min(S.count(c1), S.count(c2)))
	else:
		c = max(S.count('R'), S.count('G'), S.count('B'))
		print(N - c)


for _ in range(int(input())):
	N = int(input())
	S = input().strip()
	A = set(S)
	if len(A) == 1:
		print(0)
	elif len(A) == 2:
		color1 = A.pop()
		color2 = A.pop()
		print(min(S.count(color1), S.count(color2)))
	else:
		color = max(S.count('R'), S.count('G'), S.count('B'))
		print(N - color)


a = int(input())
for i in range(a):
	b = int(input())
	l = input()
	r = l.count('R')
	g = l.count('G')
	b = l.count('B')
	print(len(l) - max(r, g, b))


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	val1 = s.count('R')
	val2 = s.count('G')
	val3 = s.count('B')
	print(len(s) - max(val1, val2, val3))


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	s = Counter(input())
	print(n - s.most_common(1)[0][1])


try:
	for _ in range(int(input())):
		N = int(input())
		C = list(input())
		l = [C.count('R'), C.count('G'), C.count('B')]
		print(sum(l) - max(l))
except:
	pass


from collections import Counter
for tc in range(int(input())):
	n = int(input())
	x = input()
	y = Counter(x)
	print(n - max(y.values()))


test = int(input())
for i in range(test):
	(r, g, b) = (0, 0, 0)
	n = int(input())
	st = input()
	for i in st:
		if i == 'R':
			r += 1
		elif i == 'G':
			g += 1
		else:
			b += 1
	lis = [r, g, b]
	a = n - max(lis)
	print(a)


for tc in range(int(input())):
	n = int(input())
	s = input()
	r = s.count('R')
	g = s.count('G')
	b = s.count('B')
	if r >= g and r >= b:
		print(len(s) - r)
	elif g >= r and g >= b:
		print(len(s) - g)
	else:
		print(len(s) - b)


for testcases in range(int(input())):
	a = int(input())
	s = input()
	d = {}
	for i in s:
		try:
			d[i]
		except:
			d[i] = 1
		else:
			d[i] += 1
	c = True
	for i in d:
		if c == True:
			c = d[i]
		elif d[i] > c:
			c = d[i]
	print(a - c)


for i in range(int(input())):
	N = int(input())
	S = input()
	c1 = S.count('G')
	c2 = S.count('B')
	c3 = S.count('R')
	print(N - max(c1, c2, c3))