N = int(input())
S = input() + '#'

flag = 0
b = 0
w = 0
ans = 0
for i in range(N + 1):
    if S[i] == '#':
        if flag == 2:
            ans += min(b, w)
            b = 1
            w = 0
            flag = 1
        else:
            b += 1
            flag = 1
    else:
        if flag == 1:
            w += 1
            flag = 2
        elif flag == 2:
            w += 1
        
print(ans)