N = int(input())
S = input()
ans = 10**8
li = [0]

b=[0]
w=[0]
for ind,i in enumerate(S):
    if(ind==0):
        if(i=='#'):
            b[-1]+=1
        else:
            w[-1]+=1
    elif(ind==N-1):
        if(i==S[ind-1]):
            if(i=='#'):
                b[-1]+=1
            else:
                w[-1]+=1
                b+=[b[-1]]
        else:
            if(i=='#'):
                b+=[b[-1]+1]
            else:
                w+=[w[-1]+1]
                b+=[b[-1]]

    else:
        if(i==S[ind-1]):
            if(i=='#'):
                b[-1]+=1
            else:
                w[-1]+=1
        else:
            if(i=='#'):
                b+=[b[-1]+1]
            else:
                w+=[w[-1]+1]
b = [0]+b
w = [0]+w
for ind,i in enumerate(w):
    ans = min(ans,w[-1]-w[ind]+b[ind])



print(ans)
