--{-# LANGUAGE OverloadedStrings #-}
--{-# LANGUAGE OverloadedLists   #-}
{-# LANGUAGE BangPatterns      #-} --引数に!
{-# LANGUAGE MultiWayIf        #-}
{-# LANGUAGE TupleSections     #-}

import Data.Bits
import Data.Foldable (foldlM,foldrM)
import Data.Maybe (fromJust)
import Data.List
--import Data.Matrix.Unboxed
import Data.Array  --変数衝突
import Data.Array.Unboxed
import Data.Array.MArray
import Data.Array.ST
import Data.Graph
--import Data.Vector as V　--変数衝突
import qualified Data.Vector.Unboxed as V
import Control.Monad
import Control.Monad.State
import Control.Monad.ST
import qualified Data.ByteString.Lazy.Char8 as B
import Debug.Trace

type Ans = Int

whites' :: String -> Int -> [Int]
whites' [] _ = []
whites' (x:xs) cnt = if x == '.' then (cnt+1):(whites' xs (cnt+1)) else cnt:(whites' xs cnt)

whites s n = 0:(whites' s n)

blacks' :: String -> Int -> [Int]
blacks' [] _ = []
blacks' (x:xs) cnt = if x == '#' then (cnt+1):(blacks' xs (cnt+1)) else cnt:(blacks' xs cnt)

blacks s n = 0:(blacks' s n)

solve :: [Int] -> [Int] -> [Int]
solve [] _ = []
solve (x:xs) (y:ys) = (x+y):(solve xs ys)

main :: IO ()
main = do
  n <- readLn :: IO Int
  s <- getLine
  traceShowM $ ((blacks s 0), (reverse (whites (reverse s ) 0)))
  print $ minimum $ solve (blacks s 0) (reverse (whites (reverse s ) 0))
