<?php

fscanf(STDIN, "%d", $N);
$S = str_split(trim(fgets(STDIN)));

# 全部黒にする場合
$all_black = 0;
for ( $i = 0 ;$i < $N ;$i++ ) {
    if ($S[$i] == '.') {
        $all_black++;
    }
}

# 全部白にする場合
$all_white = 0;
for ( $i = 0 ;$i < $N ;$i++ ) {
    if ($S[$i] == '#') {
        $all_white++;
    }
}

# 連続した黒白の石を交互にした配列を作る
$count_white = 0;
$count_black = 0;
$sum = [];
for ( $i = 0 ;$i < $N ;$i++ ) {
    if ($S[$i] == '#') {
        $count_black++;
        if ($count_white > 0) {
            $sum[] = $count_white;
            $count_white = 0;
        }
    }

    if ($S[$i] == '.') {
        $count_white++;
        if ($count_black > 0) {
            $sum[] = $count_black;        
            $count_black = 0;
        }
    }
}

# 黒から始まっている場合、先頭を白始まりにする
if ($S[0] == '#') {
    array_unshift($sum, 0);
}
 
$index = count($sum);
$ans = [];
for ( $i = 0 ;$i < $index; $i+=2 ) {
    $ans[] = count_white($sum, $index) + count_black($sum, $index);
}
$ans[] = $all_black;
$ans[] = $all_white;

echo min($ans);

function count_white($sum, $cut) {
    $count_white = 0;
    for ( $i = 0 ; $i < $cut ; $i+=2 ) {
        if ($i % 2 == 0) {
            $count_white+= $sum[$i];
        }
    }    
    return $count_white;
}

function count_black($sum, $cut) {
    $N = count($sum);
    $count_black = 0;
    for ( $i = $cut ;$i < $N ;$i+=2 ) {
        if ($i % 2 == 0) {
            $count_black+= $sum[$i];
        }
    }    
    return $count_black;
}