#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<stack>
#include<map>
#include<cstdint>
#include<unordered_map>
#include<boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < ( int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define vi vector<int>
#define vll vector<ll>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second


namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	deque<pair<int, int>>bw;
	deque<int>cp;
	int cnt = 1;
	bool whstart = true;
	if (s[0] == '#') {
		whstart = false;
	}
	rep(i, n-1) {
		if (s[i] == s[i + 1]) {
			cnt++;
		}
		else {
			if (s[i] == '#') {
				bw.push_back(make_pair(cnt,1));
			}
			else {
				bw.push_back(make_pair(cnt, 0));
			}
			cnt = 1;
		}
	}
	if (cnt > 0) {
		if (s[n - 1] == '#') {
			bw.push_back(make_pair(cnt, 1));

		}
		else {
			bw.push_back(make_pair(cnt, 0));
		}
	}
	int wmax = 0;
	rep(i, bw.size()) {
		if (bw[i].second == 0) {
			wmax += bw[i].F;
		}
	}
	int bsum = 0, wsum = 0;
	rep(i, bw.size()) {
		if (bw[i].second == 1) {
			bsum += bw[i].first;
		}
		else {
			wsum += bw[i].first;
		}
		cp.push_back(bsum+ wmax - wsum);
	}
	sort(all(cp));
	cout << cp[0] << endl;
}
