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

idx="none"
count=0
count2=0
flag=0
for i in range(N-1,-1,-1):
    if S[i]=="#":
        count2+=1
    if flag and S[i]=="#":
        count+=1

    elif S[i]==".":
        if not flag:
            idx=i
        flag=1

idx2=-1
for i in range(N):

    if S[i]==".":
        idx2=i
    else:
        break
if idx=="none":
    print(0)
else:
    #print(count,idx)
    print(min(count2,N-count2,count,idx+1-count,idx+1-count-(idx2+1)))
