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

    // 右側から黒の石を除外したリストを作成
    var reversed = s.toCharArray().reversed()
    var drop = 0
    for (c in reversed) {
        if (c == '#') {
            drop++
        } else {
            break
        }
    }
    reversed = reversed.drop(drop)

    // それ以外を全部白か黒に置き換え
    val allBlack = reversed.count({ it == '.' })
    if (allBlack < res) {
        res = allBlack
    }
    
    val allWhite = reversed.count({ it == '#' })
    if (allWhite < res) {
        res = allWhite
    }
    
    println(res)
}

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