fun main(args: Array<String>) {
    val N = readLine()!!.toInt(); val S = readLine()!!

    val W = S.split("#").map { it.length }.let { if (S.first() == '.') it.drop(1) else it }
    val B = S.split(".").map { it.length }

    val counts = mutableListOf<Int>()
    for (i in B.indices) {
        counts.add(W.filterIndexed { index, j -> index >= i }.sum() + B.filterIndexed { index, j -> index < i }.sum())
    }
    println(counts.min())
}