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];
	
	let nB = 0;
	let nW = 0;
	let rightW = null;
	let leftB = null;
	
	for(let i=0; i<N; i++){
		if(S[i]=="."){
			nW++;
			rightW = i;
		} else {
			nB++;
			leftB === null && (leftB = i);
		}
	}
	
	const ans = nB*nW ? Math.min(rightW+1-nW, N-leftB-nB) : 0;
	console.log(ans);
});