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

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

$black = 0;
$blackFirstPos = strpos($s, '#');
$requireChangeWhite = 0;

for ($i = 0; $i < $n;$i++) {
    if ($i+1 === $n && $s[$i] ===  '#') {
        continue;
    } else {
        if ($s[$i] === '#') {
            $black++;
        } else {
            if ($i > $blackFirstPos) {
                $requireChangeWhite++;
            }
            $white--;
        }
    }
}


echo min($black, $requireChangeWhite).PHP_EOL;
