n = int(input())
s = input()

b, w, ans = 0, 0, 0
x = s[0]
f = 0
for i in range(n):
    if f and s[i] == x:
        ans += min(b, w)
        f = 0
        b, w = 1, 0
    elif s[i] == x:
        b += 1
    else:
        w += 1
        f = 1

ans += min(b, w)
print(ans)