<?php
$n = (int)trim(fgets(STDIN));
$s = trim(fgets(STDIN));

$min = $min2 = $n;

$black_cnt = [0];
$white_cnt = [0];

// 累積和
for ($i=0; $i < $n; $i++) { 
	$tmp = $s[$i];
	if ($tmp === '#') {
		$black_cnt[$i+1] = $black_cnt[$i]+1;
		$white_cnt[$i+1] = $white_cnt[$i];
	}else{
		$black_cnt[$i+1] = $black_cnt[$i];
		$white_cnt[$i+1] = $white_cnt[$i]+1;
	}
}

$left = 0;
$right = $n;

while ($left < $right) {
	$mid = (int)floor(($left+$right)/2);
	if (ev($mid) < $min) {
		$min = ev($mid);
		$left = $mid+1;
	}else{
		$right = $mid;
	}
}
$left = 0;
$right = $n;
while ($left < $right) {
	$mid = (int)floor(($left+$right)/2);
	if (ev($mid) < $min2) {
		$min2 = ev($mid);
		$right = $mid;
	}else{
		$left = $mid+1;
	}
}
echo min($min, $min2);


function ev($p){
	global $n;
	global $black_cnt;
	global $white_cnt;
	$b_sum_left = $black_cnt[max(0, $p-1)] - $black_cnt[0];
	$w_sum_right = $white_cnt[$n] - $white_cnt[$p];
	return $b_sum_left + $w_sum_right;
}