#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define int long long
using namespace std;
int n, b[234567], w[234567];
string s;
signed main() {
	cin >> n >> s;
	for (int i = 1; i <= n; i++) {
		if (s[i - 1] == '#')b[i]++; else w[i]++;
		b[i + 1] += b[i]; w[i + 1] += w[i];
	}
	int ans = n + 1;
	for (int i = 0; i <= n; i++) ans = min(ans, b[i] + w[n] - w[i]);
	cout << ans << endl;
}