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

    for(i in 0 until n){
        if (l[i] == '#') {
            blackOnRight -= 1
        }
        else{
            whiteonLeft += 1
        }
        a = min(blackOnRight + whiteonLeft, a)
    }
    println(a)
}