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

import math

x = int(input())
a = list(input())


def getMovesCount(a):
    if len(a) == 2 and a[0] == a[1]:
        return 1
    r = a.count('r')
    b = a.count('b')
    k = {'r': 'b', 'b': 'r'}
    if abs(r - b) <= 1:  # rozdiel v pocte medzi cervenymi a ciernymi udava pocet prefarbeni
        # zisti pocet nespravne umiestnenych/2
        ma_ist = a[0]
        result = 0
        for i in range(len(a)):
            if a[i] != ma_ist:
                result += 1
            ma_ist = k[ma_ist]
        return math.ceil(result/2)
    # todo
    ma_ist = a[0]
    result = 0
    for i in range(len(a)):
        if a[i] != ma_ist:
            result += 1
        ma_ist = k[ma_ist]
    maxp = (max(r, b) - result)//2
    return result//2 + maxp


# print(getMovesCount(list('bbr'*50000)))
print(getMovesCount(a))
