#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	string s;
	cin >> n >> s;
	s += 'Y';
	vector<int> wh(n + 1,0),bl(n+1,0);
	int co = 0;
	for (int i = 1;i < n + 1;i++) {
		if (s[i-1] == '#')
			co++;
		wh[i] = co;
	}
	co = 0;
	for (int i= n-1;i >= 0;i--) {
		if (s[i] == '.')
			co++;
		bl[i] = co;
	}
	int ans = 200000;
	for (int i = 0;i < n + 1;i++) {
		ans = min(ans, wh[i] + bl[i]);
	}
	cout << ans << endl;
}