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

    val lCumSum = mutableListOf(0)
    for(i in 1..n) {
        lCumSum.add(lCumSum[i - 1] + if(s[i-1] == '#') 1 else 0)
    }

    var minAns = n
    for(i in 0..n) {
        val ans = lCumSum[i] + ((n - i) - (lCumSum[n] - lCumSum[i]))
        minAns = listOf(minAns, ans).min()!!
    }
    println(minAns)
}