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

    var bCnt = 0
    var wCnt = 0
    var ans = 0

    for (i in ss.indices) {
        if (wCnt > 0 && ss[i] == '#') {
            ans += Math.min(bCnt, wCnt)
            bCnt = 1
            wCnt = 0
        } else {
            if (ss[i] == '#') bCnt++
            if (ss[i] == '.') wCnt++
        }
    }
    ans += Math.min(bCnt, wCnt)

    println(ans)
}