N=int(input())
S=input()
ans=0
black=0
white=0
if S[0]=='.':
    white+=1
else:
    black+=1
for n in range(N-1):
    if S[n+1]=='.':
        white+=1
    else:
        black+=1
    if S[n]=='#' and S[n+1]=='.':
        ans+=min(black,white)
        black=0
        white=0
    elif S[n]=='.' and S[n+1]=='.':
        black=0
    elif S[n]=='#' and S[n+1]=='#':
        white=0
    elif S[n]=='.' and S[n+1]=='#':
        white=0
print(ans)
