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

    val wsum = Array(n + 1) { 0 }
    val bsum = Array(n + 1) { 0 }

    for (i in 0 until n) {
        wsum[i + 1] = wsum[i] + (if (s[i] == '.') 1 else 0)
        bsum[i + 1] = bsum[i] + (if (s[i] == '#') 1 else 0)
    }

    var ans = Int.MAX_VALUE
    for (left in 0..n) {
        var tmp = 0
        tmp += bsum[left] - bsum[0]
        tmp += wsum[n] - wsum[left]

        ans = Math.min(ans, tmp)
    }

    println(ans)
}