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 ret = min
    s.reverse.dropWhile(_ == '#').reverse.foreach ({
      v => v match {
        case '#' =>  min = min + 1; ret = ret.min(min)
        case '.' => min = min - 1; ret = ret.min(min)
      }
    })

    ret
  }

  
  println(solve2(s))


}

  

