module Main where

import           Control.Monad
import           Data.List
import           Data.Ord
import           Data.List.Split
import           Data.Array.IO
import qualified Data.Vector            as V
import           Data.Maybe
import           Text.Printf

main :: IO ()
main = do
  _ <- getLine
  s <- getLine
  let grs = map length $ (\x -> if last s == '#' then x ++ [[]] else x) . (\x -> if head s == '.' then []:x else x) $ group s
      ids = map (`splitAt` grs) [2,4 .. length grs]
  print $ minimum [minimum $ map (\(a, b) -> g a + g b) ids, length $ elemIndices '#' s, length $ elemIndices '.' s]
  where
    g [] = 0
    g [a] = 0
    g a = let len = length a in sum [a !! x | x <- [1,3..len]]
