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

    val wCnt = IntArray(n) {0}
    val bCnt = IntArray(n) {0}

    wCnt[0] = if (ss[0] == '.') 1 else 0
    bCnt[0] = if (ss[0] == '#') 1 else 0

    for (i in 1 until n) {
        wCnt[i] = wCnt[i-1] + if (ss[i] == '.') 1 else 0
        bCnt[i] = bCnt[i-1] + if (ss[i] == '#') 1 else 0
    }

    var min = wCnt.last()

    for (i in ss.indices) {
        val lMin = bCnt[i]
        val rMin = wCnt.last() - wCnt[i]
        min = Math.min(min, lMin+rMin)
    }

    println(min)
}