fun main(args:Array<String>?): Unit {
    val n = readLine()!!.trim().toInt()
    val state = readLine()!!.trim()
    val countWhite = IntArray(n + 1){if (it > 0 && state[it - 1] == '.') 1 else 0}
    for (i in 1 .. n) countWhite[i] += countWhite[i - 1]
    println(
            (0 .. n).map{i ->
                val leftBlack = i - countWhite[i]
                val rightWhite = countWhite.last() - countWhite[i]
                leftBlack + rightWhite
            }.min()!!
    )
}