var lines = []; var result = Infinity;
var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
});

rl.on('close', function () {
    var N = Number(lines[0]);
    var S = lines[1].split("");


    var sum = [0];
    var now = "."; var j;

    if (now === S[0]) { sum[0] = 1; j = 0; }
    else { now = "#"; sum[1] = 1; j = 1; }

    for (var i = 1; i < N; i++) {
        if (now === S[i]) { sum[j]++; }
        else {
            now === "#" ? now = "." : now = "#";
            j++; sum[j] = 1;
        }
    }

    // ....####になれば良い
    // 境界が判明すれば解を求められる
    var cnt = 0;

    for (var i = 0; i < sum.length; i=i+2) {
        // .#の境界が0の時 全部#
        // .#の境界がsum.lengthの時 全部.

        // ".","#"を入れ替える
        for (var j = 0; j < sum.length; j++) {

            // "#"の時
            if (j % 2 === 0 && i < j) {
                cnt += sum[j];
            }
            // "."の時
            if (j % 2 === 1 && j < i) {
                cnt += sum[j];
            }
        }

        result = Math.min(result, cnt);
        cnt = 0;
    }

    console.log(result);
});
