f(x:s)=if null s then 0 else if x=='#' then min(g (x:s) '.')(g (x:s) '#') else f s
g(x:s)k=(if x==k then 1 else 0)+(if null s then if k=='#' && x=='#' then -1 else 0 else g s k)
main=do
 x<-getLine
 s<-getLine
 print$f s