#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<list>
#include<map>
#include<vector>

using namespace std;


#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define ll long long
#define mod 1000000007

#define imin int_min;
#define imax int_max;


int main(){
	int n;
	string s;
	cin >> n >> s;
	int offset=0;
	rep(i, n) {
		if (s[i] == '.') offset++;
		else break;
	}
	int roffset=0;
	for(int i=n; i>0; i--) {
		if (s[i] == '#') roffset++;
		else break;
	}
	int cnt=0;
	vector<int> counts;
	bool flag = false;
	if (offset >= n-roffset) cout << 0 << endl;
	else {
		rep(i, n-1) {
			if (s[i] == '#') {
				if (!flag) cnt++;
				else {
					flag = false;
					counts.push_back(cnt);
				}
			}
			else {
				if (flag) cnt++;
				else {
					flag = true;
					counts.push_back(cnt);
				}
			}
		}
		if (s[n-1] == '#') {
			if (!flag) counts.push_back(cnt+1);
			else {
				counts.push_back(cnt);
				counts.push_back(1);
			}
		}
		if (s[n-1] == '.') {
			if (flag) counts.push_back(cnt+1);
			else {
				counts.push_back(cnt);
				counts.push_back(1);
			}
		}

		int dt = 0;
		rep(i, counts.size()) {
			if (i % 2 == 1) dt += counts[i];
		}
		int sh = 0;
		int cnt = 0;
		
		vector<int> sharp, dot;
		int poscnt = 0, negcnt = 0;
		rep(i, counts.size()) {
			if (i % 2 == 0) {
				poscnt += counts[i];
				sharp.push_back(poscnt);
			}
			else {
				negcnt += counts[i];
				dot.push_back(negcnt);
			}
		}
		/*
		rep(i, sharp.size()) cout << sharp[i] << endl;
		rep(i, dot.size()) cout << dot[i] << endl;
		cout << sharp.size() << dot.size() << endl;
		*/

		vector<int> diff;
		rep(i, sharp.size()) {
			diff.push_back(dt + sh);
			sh += sharp[i];
			dt -= dot[i];
		}
		int mini = int_max;
		rep(i, diff.size()) mini = min(mini, diff[i]);

		cout << mini << endl;
	}


	return 0;
}

