N = int(input())
S = input()
k = -1
tmp=0
for n,i in enumerate(S):
    if i=="#":
        k = n
        break
for i in S[::-1]:
    if i=="#":
        tmp-=1
    else:
        break

if k==-1:
    print(0)
else:
    if tmp!=0:
        SS = S[k:tmp]
    else:
        SS = S[k:]
    t =  sum([1 if i=="." else 0 for i in SS])
    print(min(t,len(SS)-t))