#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<int>black, white;
	int cnt = 1;
	bool flag = true;
	if (s[0] == '#') {
		flag = false;
	}
	rep(i, n) {
		if (s[i] == s[i + 1]) {
			cnt++;
		}
		else {
			if (s[i] == '#') {
				black.push_back(cnt);
			}
			else {
				white.push_back(cnt);
			}
			cnt = 1;
		}
	}
	if (cnt > 1) {
		if (s[n - 1] == '#') {
			black.push_back(cnt);
		}
		else {
			white.push_back(cnt);
		}
	}
	bool whend = true;
	if (s[n - 1] == '#') {
		whend = false;
	}
	int whsum = 0;
	int blsum = 0;
	rep(i, black.size()) {
		blsum+=black[i] ;
	}
	//cout << endl;
	rep(i, white.size()) {
		whsum+= white[i];
	}
	//cout << endl;
	
	int ans = 0;
	//cout << whsum << " " << blsum << endl;
	if (flag) {
		whsum -= white[0];
		if (!whend) {
			blsum -= black[black.size() - 1];
		}
		ans = min(blsum, whsum);
	}
	else {
		if (!whend) {
			blsum -= black[black.size() - 1];
		}
		ans = min(blsum, whsum);
	}
	cout << ans << endl;
}
