object Main {

  def main(args: Array[String]): Unit = {
    
    def counter(input: List[Char]): Int = {
      def min(a: Int, b: Int): Int =
        if (a > b) b else a
      @annotation.tailrec
      def black(wCount: Int, bCount: Int, l: List[Char], acm: Int): Int =
        l match {
          case Nil => acm
          case '#' :: t => black(wCount, bCount + 1, t, acm)
          case '.' :: t => white(wCount + 1, bCount, t, acm)
        }
      @annotation.tailrec
      def white(wCount: Int, bCount: Int, l: List[Char], acm: Int): Int =
        l match {
          case Nil if bCount > 0 => acm + min(wCount, bCount)
          case Nil => acm
          case '#' :: t => black(0, 1, t, acm + min(wCount, bCount))
          case '.' :: t => white(wCount + 1, bCount, t, acm)
        }

      input match {
        case '#' :: t => black(0, 1, t, 0)
        case '.' :: t => white(1, 0, t, 0)
      }
    }
    
    scala.io.StdIn.readLine()
    println(counter(scala.io.StdIn.readLine().toList))
  }

}