import java.lang.Math.min

fun Boolean.toInt() = if (this) 1 else 0

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val s = readLine()!!.reversed()
    var dp = Array(2) {
        Array<Int>(n + 1) { 0 }
    }
    for (i in listOf(0, 1)) {
        for (j in 0 until n) {
            dp[0][j + 1] = dp[0][j] + (s[j] == '.').toInt()
            dp[1][j + 1] = min(dp[0][j], dp[1][j] + (s[j] == '#').toInt())
        }
    }
    println(min(dp[0][n], dp[1][n]))
}