Chef is playing a game which contains a binary string. 
He can perform one operation only:
- Toggle the i_th bit of the string (0 to 1 or 1 to 0)
By performing operations on the string (can be zero times), you have to convert the string with no adjacent bit being the same.
Can you help chef ?

-----Input:-----
- First line will contain $T$, number of test cases. Then the test cases follow. 
- First line of each test case, contains the size of the  string $N$
- Seond line contains a single line of input, the binary string. 

-----Output:-----
For each testcase, output in a single line answer - the minimum operations.

-----Constraints-----
- $1 \leq T \leq 100$
- $2 \leq |S| \leq 10^3$

-----Sample Input:-----
1
4
1011

-----Sample Output:-----
1

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
from sys import stdin, stdout
test = int(stdin.readline())
for _ in range(test):
	N = int(stdin.readline())
	seq = list(input())
	(fp, fp1, fl, fl1) = (0, 0, 0, 1)
	for i in range(N):
		if fl != int(seq[i]) - 0:
			fp += 1
		fl = 1 - fl
	for i in range(N):
		if fl1 != int(seq[i]) - 0:
			fp1 += 1
		fl1 = 1 - fl1
	print(fp) if fp < fp1 else print(fp1)


def a(s, length):
	ans = 0
	for i in range(0, length):
		if i % 2 == 0 and s[i] == '1':
			ans += 1
		if i % 2 == 1 and s[i] == '0':
			ans += 1
	return min(ans, length - ans)

def b(s, length):
	ans = 0
	for i in range(0, length):
		if i % 2 == 0 and s[i] == '0':
			ans += 1
		if i % 2 == 1 and s[i] == '1':
			ans += 1
	return min(ans, length - ans)
for i in range(0, int(input())):
	n = int(input())
	s = input()
	print(min(a(s, n), b(s, n)))


n = int(input())
l2 = ['0', '1']
for i in range(n):
	s = int(input())
	w = input()
	l1 = []
	count = 0
	count1 = 0
	for i in w:
		l1.append(i)
	l2 = []
	l3 = []
	i = 1
	l2.append('1')
	l3.append('0')
	while i < s:
		l2.append('0')
		l2.append('1')
		l3.append('1')
		l3.append('0')
		i += 1
	for i in range(s):
		if l1[i] != l2[i]:
			count += 1
	for i in range(s):
		if l1[i] != l3[i]:
			count1 += 1
	if count > count1:
		print(count1)
	else:
		print(count)


intinp = lambda : int(input())

def listinp(func=int):
	return list(map(func, input().split()))

def nsepline(n, func=str):
	return [func(input()) for _ in range(n)]

def printlist(li, glue=' '):
	return glue.join(list(map(str, li)))
for _ in range(intinp()):
	n = intinp()
	s = list(map(int, input()))
	nn = n + 1 if n & 1 == 1 else n
	x1 = '10' * nn
	x2 = '01' * nn
	c1 = c2 = 0
	for i in range(n):
		if s[i] != int(x1[i]):
			c1 += 1
		if s[i] != int(x2[i]):
			c2 += 1
	print(min(c1, c2))


for i in range(int(input())):
	n = int(input())
	l = input()
	k = n // 2
	p = '10' * k
	q = '01' * k
	x = y = 0
	if n % 2 == 0:
		for i in range(n):
			if l[i] != p[i]:
				x = x + 1
			if l[i] != q[i]:
				y = y + 1
		print(min(x, y))
	else:
		p = p + '1'
		q = q + '0'
		for i in range(n):
			if l[i] != p[i]:
				x = x + 1
			if l[i] != q[i]:
				y = y + 1
		print(min(x, y))


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	s1 = ''
	s0 = ''
	for i in range(n):
		s1 += str(i % 2)
		s0 += str((i + 1) % 2)
	count1 = 0
	count0 = 0
	for i in range(n):
		if s[i] != s1[i]:
			count1 += 1
		if s[i] != s0[i]:
			count0 += 1
	print(min(count1, count0))


def solve(s, n):
	ans = 0
	for i in range(n):
		if i % 2 == 0 and s[i] == '1':
			ans += 1
		if i % 2 == 1 and s[i] == '0':
			ans += 1
	return min(ans, n - ans)
for _ in range(int(input())):
	n = int(input())
	s = input()
	n = len(s)
	print(solve(s, n))


def flip(ch):
	return '1' if ch == '0' else '0'

def FlipWithStart(str, expected):
	flipCount = 0
	for i in range(len(str)):
		if str[i] != expected:
			flipCount += 1
		expected = flip(expected)
	return flipCount

def minFlip(str):
	return min(FlipWithStart(str, '0'), FlipWithStart(str, '1'))
for _ in range(int(input())):
	n = int(input())
	s = input()
	print(minFlip(s))


t = int(input().strip())
for _ in range(t):
	n = int(input().strip())
	bits = input().strip()
	check1 = ''
	check2 = ''
	c1 = 0
	for _ in range(n):
		check1 = check1 + str(c1)
		check2 = check2 + str((c1 + 1) % 2)
		c1 = (c1 + 1) % 2
	no1 = 0
	no2 = 0
	for i in range(n):
		no1 = no1 + (1 if not bits[i] == check1[i] else 0)
		no2 = no2 + (1 if not bits[i] == check2[i] else 0)
	print(min(no1, no2))


for t in range(int(input())):
	n = int(input())
	s = input()
	count1 = count2 = 0
	for i in range(len(s)):
		if i % 2 == 0:
			if s[i] != '1':
				count1 += 1
			if s[i] != '0':
				count2 += 1
		if i % 2 == 1:
			if s[i] != '0':
				count1 += 1
			if s[i] != '1':
				count2 += 1
	print(min(count1, count2))


def min_changes(a, n):
	ans_a = 0
	ans_b = 0
	for i in range(n):
		if i % 2 == 0:
			if a[i] == 0:
				ans_a += 1
			else:
				ans_b += 1
		elif a[i] == 0:
			ans_b += 1
		else:
			ans_a += 1
	return min(ans_a, ans_b)
for _ in range(int(input())):
	n = int(input())
	s = input()
	s = list(s)
	s = [int(x) for x in s]
	print(min_changes(s, len(s)))


x = int(input())

def minReplacement(s, length):
	ans = 0
	for i in range(0, length):
		if i % 2 == 0 and s[i] == '1':
			ans += 1
		if i % 2 == 1 and s[i] == '0':
			ans += 1
	return min(ans, length - ans)
for i in range(x):
	length = int(input())
	s = input()
	print(minReplacement(s, length))


def min_changes(a, n):
	a1 = 0
	b1 = 0
	for i in range(n):
		if i % 2 == 0:
			if a[i] == '0':
				a1 += 1
			else:
				b1 += 1
		elif a[i] == '0':
			b1 += 1
		else:
			a1 += 1
	return min(a1, b1)
t = int(input())
while t > 0:
	n = int(input())
	s = input()
	s = list(s)
	print(min_changes(s, n))
	t -= 1


import io, sys, os
import math as ma
from decimal import Decimal as dec
from itertools import permutations
from itertools import combinations

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

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

def nu():
	return int(input())

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	gg = find_gcd(x, y)
	return x * y // gg
mm = 1000000007

def solve():
	t = nu()
	for tt in range(t):
		n = nu()
		s = input()
		x = ''
		y = ''
		for i in range(len(s)):
			if i % 2 == 0:
				x += '0'
				y += '1'
			else:
				x += '1'
				y += '0'
		cc = 0
		pp = 0
		for i in range(len(s)):
			if s[i] != x[i]:
				cc += 1
			if s[i] != y[i]:
				pp += 1
		print(min(cc, pp))

def __starting_point():
	solve()
__starting_point()


import sys

def __starting_point():
	t = int(input())
	for i in range(t):
		n = int(input())
		s1 = input()
		s = 0
		a1 = []
		a2 = []
		for i in range(n):
			a1.append(s)
			s = s ^ 1
		s = 1
		for i in range(n):
			a2.append(s)
			s = s ^ 1
		c1 = 0
		c2 = 0
		for i in range(n):
			if int(s1[i]) != a1[i]:
				c1 += 1
		for i in range(n):
			if int(s1[i]) != a2[i]:
				c2 += 1
		print(min(c1, c2))
__starting_point()


for a0 in range(int(input())):
	n = int(input())
	(s, x) = ('', '')
	k = input()
	for i in range(n):
		s += str((i + 1) % 2)
		x += str(i % 2)
	(hee, hoo) = (0, 0)
	for i in range(n):
		if k[i] != s[i]:
			hee += 1
		if k[i] != x[i]:
			hoo += 1
	print(min(hee, hoo))