N = int(input())
S = input()

S = S + "#"

# is black, . is white
seq_black = 0
seq_white = 0
ans = 0
for idx, s in enumerate(S):
    if idx == 0:
        former = s
        if s == "#":
            seq_black += 1
    else:
        if s == "#":
            if seq_white > 0:
                ans += min(seq_black, seq_white)
                seq_black = 0
                seq_white = 0
                
            if former == s:
                seq_black += 1
            else:
                seq_black = 1
            
        else:
            # white
            if seq_black > 0:
                seq_white += 1
                
        former = s
print(ans)
                
            
    