main :: IO ()
main = do
  n <- (read :: String -> Int) <$> getLine
  s <- app <$> getLine
  print $ (\(a,b,c) -> a) $ ans s

ans :: (Int,Int,[Int]) -> (Int,Int,[Int])
ans (m,bn,[]) = (min m bn,bn,[])
ans (m,bn,w:b:ns) = ans (min m bn,bn+w-b,ns)

app :: String -> (Int,Int,[Int])
app str = finfunc $ foldl func initial str where
  initial = ('#',0,[],0)
  finfunc (c,i,is,n) = if c == '#' then (n+1,n+1,0:i:is) else (n,n,i:is)
  func a@(c,i,is,n) k
    | a == initial && k == '.' = (k,1,[0],0)
    | c == k = if k == '#' then (k,i+1,is,n+1) else (k,i+1,is,n)
    | c /= k = if k == '#' then (k,1,i:is,n+1) else (k,1,i:is,n)