N=int(input())
S=input()
ans=0
black=0
white=0
for n in range(N):
    if S[n]=='.':
        white+=1
    else:
        black+=1
stones={'b':0,'w':white}
for n in range(N-1):
    if S[n]=='#':
        stones['b']+=1
    else:
        stones['w']-=1
    if S[n]!=S[n+1]:
        ans+=min(stones['b'],stones['w'])
print(min(ans,black,white))
