process.stdin.resume();
process.stdin.setEncoding('utf8'); 
var lines = [];
var reader = require('readline').createInterface({
	input: process.stdin,
	output: process.stdout
});
 
reader.on('line', (line) => {
	lines.push(line);
});

reader.on('close', () => {
	"use strict"
	const N = +lines[0];
	const S = lines[1];
	
	const nB = S.match(/#/g) ? S.match(/#/g).length : 0;
	const nW = N - nB;
	
	let ans = nW;
	let bestAns = nW;
	for(let i=0; i<N; i++){
		lines[i]=="#" ? ans++ : ans--;
		bestAns>ans && (bestAns=ans);
	}
	
	console.log(bestAns);
});