# -*- coding: utf-8 -*-
 
N = int(input())
S = input()

array = [0]

before = S[0]
add = 0

for s in S:
	if before == s:
		array[-1] = array[-1] + 1
	else:
		array.append(1)
	before = s

# if S[0] == '.':
array.pop(0)


# print(array)
result = 0
for i in range(len(array)):
	if i % 2:
		continue
	if i + 1 >= len(array):
		result += array[i]
	else:
		result += min(array[i],array[i+1])

print(result)
