import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val s = sc.next()

    var count = 0
    val bc = listOf(0) + s.map {
        if (it == '#') count++
        count
    }

    val c = bc.last()
    val ret = bc.foldIndexed(Integer.MAX_VALUE) { index, acc, next ->
        val cur = bc[index] + ((n - index) - (c - bc[index]))
        Math.min(acc, cur)
    }

    println(ret)
}
