fun main(args: Array<String>) {
    val n = Integer.parseInt(readInputLine())
    var s = readInputLine()
    
    var res = Int.MAX_VALUE

    if (s.get(n - 1) == '#') {
        // 一番右側が黒の場合は一番右側以外を黒か白に全置き換え
        s = s.substring(0, n)
    }
    
    val allBlack = s.filter({ it == '.' }).length
    if (allBlack < res) {
        res = allBlack
    }
    
    val allWhite = s.filter({ it == '#' }).length
    if (allWhite < res) {
        res = allWhite
    }
    
    println(res)
}

fun readInputLine(): String {
    return readLine()!!
}
