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 += b
            b = 1
            w = 0
            flag = 1
        else:
            b += 1
            flag = 1
    else:
        if flag == 1:
            w += 1
            flag = 2
        elif flag == 2:
            w += 1
        
flag = 0
b = 0
w = 0
ans2 = 0
for i in range(N + 1):
    if S[i] == '#':
        if flag == 2:
            ans2 += 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(min(ans, ans2))