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
import sys, threading

a = []
dp = {}

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

    if i == 0:
        return 0

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

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

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

def main():
    n = int(raw_input())
    l = raw_input()
    for x in l:
        a.append(int(x=='b'))
    ans = solve(a[n-1], 1, n-1)
    dp.clear()
    print min(ans, solve((a[n-1]+1)%2, 0, n-1) + 1)

if __name__ == "__main__":
    sys.setrecursionlimit(200000)
    threading.stack_size(10240000)
    thread = threading.Thread(target=main)
    thread.start()
