function Main(input) {
    const N = parseInt(input[0])
    const S = input[1]
    
    var count = 0;
    var countB = 0;
    var isDirty = false;
    for(var i = 0; i < N; i++){
        if (S.charAt(i) == "#") {
            countB++
            isDirty = true;
        } else if(isDirty) {
            count++;
        }
    }
    console.log(Math.min(count, countB));
}

// 改行・空白で分割
Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));