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

__author__ = 'ad'

size = int(input())
line = raw_input()
counter = 0
answer = 0

while (size - counter) >= 2:
    one = line[counter]
    two = line[counter + 1]
    if (size - counter) > 2:
        three = line[counter + 2]
    if (size - counter) > 3:
        four = line[counter + 3]
    # print
    # print(counter)
    # print(one)
    # print(two)
    # if (size - counter) > 2:
    #     print(three)
    # if (size - counter) > 3:
    #     print(four)
    #
    # print
    if one is three is not two:
        counter += 2


    elif one is two and three is four and one is not three:
        answer += 1
        counter += 3
    elif one is four and two is three and one is not two:
        answer += 1
        counter += 4

    elif two is three is not one:
        answer += 1
        counter += 2
    elif one == two == three:
        answer += 1
        counter += 2
    elif one is two is not three:
        answer += 1
        counter += 3

print(answer)
