"use strict";
function Main(input) {
    let cin = new Inputer(input);
    let N = cin.getInt(), S = cin.getStr();
    const W = ".", B = "#";
    let stones = new Array(N+2).fill(0).map(() => { return {".":0, "#":0} });
    for (let n = 0; n < N; n++) stones[n+1][S.charAt(n)]++;
    for (let n = 0; n < N; n++) stones[n+1][B] += stones[n][B];
    for (let n = N+1; n > 1; n--) stones[n-1][W] += stones[n][W];
    let ans = Number.MAX_SAFE_INTEGER;
    for (let n = 0; n <= N; n++) ans = Math.min(ans, stones[n][B] + stones[n+1][W]);
    console.log(ans);
}
class Inputer{constructor(t){this.cnt=0,this.items=t.split(/\n|\s/)}getInt(){return this.items[this.cnt++]-0}getIntArray(t){let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getInt();return r}getStr(){return this.items[this.cnt++]}getStrArray(t){let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getStr();return r}}
if (typeof window == "undefined") Main(require("fs").readFileSync("/dev/stdin", "utf8"));