<?php
fscanf(STDIN, '%d', $n);
fscanf(STDIN, '%s', $s);

$white = substr_count($s, '.');
if ($white === 0 || $white === $n) {
    echo 0;
    return;
}

$black = 0;
$res = 0;
for ($i = 0; $i < $n;$i++) {
    if ($s[$i] === '#') {
        $black++;
    } else {
        $white--;
    }
    $res += min($black, $white);
}
if ($s[0] === '#') {
    echo $n - $black;
} else {
    $ans = min($res, $black);
    echo $ans >= 0 ? $ans : 0;
}