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

    var ans = 0

    var b = 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) {
                ans += w
                b += w
                w = 0
                continue
            }

            ans += b
            b = 0
            w = 0
        }
    }

    ans += Math.min(b, w)

    println(ans)
}