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 sw = mutableListOf<Int>()
    sw.add(W.sum())
    W.forEach { sw.add(sw.last() - it) }

    val sb = mutableListOf<Int>()
    sb.add(0)
    B.forEach { sb.add(sb.last() + it) }

    val counts = mutableListOf<Int>()
    for (i in B.indices) {
        val w = if (i in sw.indices) sw[i] else 0
        val b = if (i in sb.indices) sb[i] else 0
        counts.add(w + b)
    }
    println(counts.min())
}