f s n
 |null s=n
 |head s=='.' = f (tail s) n+1
 |otherwise=n+1
g s n
 |null s=n
 |head s=='#' = g (tail s) n+1
 |otherwise=n+1
main=do
 l<-readLn :: IO Int
 s<-getLine
 let sr=f s 0
     srr=g (reverse s) 0
     sp=take (l-sr)$reverse s
     sl=length$filter(=='.')sp
     sq=take (l-srr) s
     sd=length$filter(=='#')sq
     ss=length$filter(=='.')s
     sa=length$filter(=='#')s
 print$if (ss==l||ss==0) || (sa==1&&last s=='#') || (ss==1&&head s=='.') then 0 else min sd sl