integer(16) N
character(2*10**5) S
integer(16) a,b,i
read*,N,S
a=index(S,"#")
b=index(S,".",.true.)
print"(I0)",f(S,a,b)

contains

recursive function f(S,a,b)result(ans)
integer(16),intent(in)::a,b
character(2*10**5)::S
character(2*10**5) S1
integer(16) a1,b1,i,ans
S1=S(a+1:b-1)
a1=index(S1,"#")
b1=index(S1,".",.true.)
ans=0
if(a1<b1)then
  do i=a1,b1-1
    if(S1(i:i)=="#")ans=ans+1
  end do
  ans=min(ans,b1-a1-ans+1,f(S1,a1,b1)+2)
endif
end function f
end