#include<iostream>
#include<iostream>
#include<string>
#include<sstream>
#include<vector>
#include<algorithm>
#include<math.h>
#include"boost/algorithm/string.hpp"

using namespace std;


int main(){
	/*Q3*/
	//w:.
	//b:#
	//#. 禁止

	int n;
	cin >> n;
	string s;
	cin >> s;

	int ret = 0;

	//全数同一
	if (string::npos == s.find('.') || string::npos == s.find('#')){
		cout << 0 << endl;

		return 0;
	}

	std::vector<int> data(300000, 0);
//	int data[300000];
	
	data[0] = 1;

	//区間を求める
	int j = 0;
	for (int i = 1; i < n; ++i){
		//同じ文字が連続
		if (s[i - 1] != s[i]){
			j++;
		}
		data[j]++;
	}

	//Right, Left
	int r = 0, l = j;
	//最初の文字を判定

	if (s[0] == '#'){
		ret += data[r++];
	}
	if (s[n - 1] == '.'){
		ret += data[l--];
	}

	//左右の区間が小さい方から変えればよい
	while (l - r > 1){
		if (data[r] < data[l]){
			ret += data[r++];
		}
		else{
			ret += data[l--];
		}
	}


	cout << ret << endl;
	
	return 0;

	/*Q2
	int n;
	cin >> n;
	
	string s;
	cin >> s;
	int k;
	cin >> k;
	k--;

	char c = s[k];

	for (int i = 0; i < s.size(); ++i){
		if (s[i]!= c){
			s[i] = '*';
		}
	}

	cout << s << endl;
	/*Q1*/
	/*
	int a, b, c;
	cin >> a >> b >> c;

	if (a < b){
		if (a < c && c < b){
			cout << "Yes" << endl;
			return 0;
		}
	}

	else{
		if (b < c && c < a){
			cout << "Yes" << endl;
			return 0;
		}


	}

	cout << "No" << endl;
	

	return 0;
	*/
}