open System

// prelude
let readStr () = stdin.ReadLine()

let readInt () = stdin.ReadLine() |> int
let readInts () = stdin.ReadLine().Split() |> Array.map int

let pair = function
| [|a; b|] -> (a, b)
| _ -> failwith "owatta"

let triple = function
| [|a; b; c|] -> (a, b, c)
| _ -> failwith "owatta"

let inc n = n + 1
let dec n = n - 1

let inline flip f a b = f b a
let rec fix f = fun x -> (f (fix f)) x

module Option =
  let getOr defaultValue = function
  | Some x -> x
  | None -> defaultValue

module Array =
  let modify (arr: _ []) i f =
    arr.[i] <- f arr.[i]

module Array2D =
  let modify (arr: _ [,]) i j f =
    arr.[i, j] <- f arr.[i, j]

// start
let N=readInt()
let S=readStr().ToCharArray()

let sumW =
  let s=
    S
    |> Array.scan (fun sum c -> sum + if c='.' then 1 else 0) 0
  fun i j -> s.[1+j] - s.[i]

let sumB=
  let s=
    S |> Array.scan (fun sum c -> sum + if c='#' then 1 else 0) 0
  fun i j -> s.[1+j] - s.[i]

let rec count acc i =
  if i>=N-1 then acc
  else
    if S.[i]='#'&&S.[i+1]='.' then count (min acc (min (sumB 0 i) (sumW (i+1) (N-1)))) (i+1)
    else count acc (i+1)

if
  0 |> (fix <| fun f i -> if i>=N-1 then false elif S.[i]='#' then true else f (i+1))
then count N 0 else 0
|> printfn "%d"