#include <iostream>
#include <string>
using namespace std;

int main() {
	int N, ans = 0, tmp = 0;
	string S;
	cin >> N >> S;
	for (char& i : S) {
		if (i == '#') ++tmp;
		else {
			if (tmp) {
				++ans;
				--tmp;
			}
		}
	}
	cout << ans;
}