import Data.List
f (a:l)=if null l then 0 else min a (head l) + (if null (tail l) then 0 else f(tail l))
main=do
 x<-getLine
 s<-group<$>getLine
 print$if length s == 1 then 0 else if (head.head)s =='#' then f ((map length)s) else f ((map length.tail)s)