fun main(args : Array<String>) {
    val n = readLine()!!.toInt()
    val ss = readLine()!!

    var firstWCnt = ss.takeWhile { it == '.' }.count()
    var lastBCnt = ss.takeLastWhile { it == '#' }.count()

    val target = ss.substring(firstWCnt until n-lastBCnt)

    println(Math.min(target.count { it == '.' }, target.count { it == '#' }))
}