fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    var l = readLine()!!
    var whiteOnRight = l.count{it == '.'}
    var blackonLeft = 0
    var a = Int.MAX_VALUE

    for(i in 0 until n){
        if (l[i] == '.') {
            whiteOnRight -= 1
        }
        a = Math.min(whiteOnRight + blackonLeft, a)
        if (l[i] == '#'){
            blackonLeft += 1
        }
    }
    println(a)
}