import scala.io.StdIn

object Main extends App {
  val n  = StdIn.readLine().toInt
  val s  = StdIn.readLine()

  def solve2(s: String): Int = {
    var min = s.count(_=='.')
    var acc = 0

    s.reverse.dropWhile(_ == '#').reverse.foreach {v =>
      if (v == '#') {
          acc += 1
      } else {
        acc -= 1
      }
    }
    min.min(acc)
  }

  
  println(solve2(s))


}

  

