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

def count_renzoku(S,s):
    renzoku=1
    for i in range(1,len(S)):
        if S[i]==s:
            renzoku+=1
        else:
            break
    return renzoku

if S.count('#')==N or S.count('.')==N:
    print(0)
else:
    a=min(S.count('#'),S.count('.'))
    T=S[::-1]
    if T[0]=='#':
        T=T[count_renzoku(T,'#'):]
    S=T[::-1]
    if S[0]=='.':
        S=S[count_renzoku(S,'.'):]
    print(min(a,S.count('#'),S.count('.')))
