var lines = []; var result = 0;
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 dot = 0; var sharp = 0;
    for (var i = 0; i < N; i++) {
        if (S[i] === "#") {
            for (var j = i; j < N; j++) {
                if (S[j] === "#") { sharp++; }
                else { dot++; }
            }
            break;
        }
    }

    var result_1 = Math.min(sharp, dot);
    var result_2 = 0;

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

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

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

    // "."の最大値
    var dot_max = 0;
    for (var i = 0; i < sum.length; i = i + 2) {
        if (dot_max < sum[i]) { dot_max = i; }
    }

    // "#"の最大値
    var sharp_max = 0;
    for (var i = 1; i < sum.length; i = i + 2) {
        if (sharp_max < sum[i]) { sharp_max = i; }
    }


    // ". -> #"書き換え
    for (var i = sharp_max + 1; i < sum.length; i = i + 2) {
        result_2 += sum[i];
    }

    // "# -> ."書き換え
    for (var i = dot_max - 1; 0 <= i; i = i - 2) {
        result_2 += sum[i];
    }
    console.log(Math.min(result_1, result_2));

});
