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

    var ans = 0

    var b = 0
    var bw = 0
    var w = 0

    if (s[0] == '#') {
        b++
    }

    for (i in (1 until n)) {
        if (s[i] == '#') {
            b++
        } else {
            w++
        }

        if (i == n - 1 || s[i] == '.' && s[i + 1] == '#') {

            if (b > w + bw) {
                ans += w
                b += w
                bw += w
                w = 0
                continue
            }

            ans += b - (bw * 2)
            b = 0
            bw = 0
            w = 0
        }
    }

    println(ans)

}