n = int(input())
s = input()
b = 0
w = 0
fb = 0
fw = 0
cnt = 0
for i in range(n):
    if s[i]=='#':
        if fw ==0:
            fb = 1
            b+=1
        else:
            cnt+=min(b,w) 
            fw=0
            w = 0
            fb=1
            b=1
    else:
        if fb==1:
            fw =1
            w +=1
else:
    if fw==1:
        cnt+=min(b,w)
print(cnt)