166
rbbbbbbbbbbbbrbrrbbrbbbrbbbbbbbbbbrbbbbbbrbbbrbbbbbrbbbbbbbrbbbbbbbrbbrbbbbbbbbrbbbbbbbbbbbbbbrrbbbrbbbbbbbbbbbbbbrbrbbbbbbbbbbbrbbbbbbbbbbbbbbrbbbbbbbbbbbbbbbbbbbbbb
 7
rrbrbrb
 1
r
 2
bb
 18
rrrrrrrrrrrrrrrrrb
 8
rbbrbrbr
 1
b
 13
rbbbrbrrbrrbb
 100
brbbbrrrbbrbrbbrbbrbbbbrbbrrbbbrrbbbbrbrbbbbbbbbbbbbbbbbrrrrbbbbrrrbbbbbbbrbrrbrbbbbrrrbbbbrbbrbbbrb
 2
rb
 2
rr
 2
br

70
 1
 0
 1
 8
 1
 0
 3
 34
 0
 1
 0

from collections import defaultdict

n = int(raw_input())
l = raw_input()
a = []
for x in l:
	a.append(int(x=='b'))

dp = {}
def solve(c, swapped, i):
	if dp.get((c, swapped, i), False):
		return dp[(c, swapped, i)]

	if i == 0:
		if a[i] != a[i-1]:
			return 0
		else:
			return int(swapped == 0)

	next = (c+1)%2
	if a[i] == a[i-1]:
		# not swapped yet
		if swapped == 1:
			# start swap
			first =  solve(next, 0, i-1) + 1
			# or paint
			second = solve(next, 1, i-1) + 1

		else:
			# swap back
			first =  solve(next, 1, i-1)
			# paint
			second = solve(next, 0, i-1) + 1

		dp[(c, swapped, i)] = min(first, second)
		return min(first, second)
	else:
		return solve(next, swapped, i-1)

print min(solve(a[n-1], 1, n-1), solve(a[n-1], 0, n-1)) 
