#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
#include <iomanip>
#include<queue>
#include<algorithm>
#include <functional>
#include<vector>
using namespace std;

long long N;
string S;
long long i = 0;
long long cnt_b;
long long cnt_w;
long long ans=0;
long long ans2 = 0;

int main() {
	cin >> N;
	cin >> S;

	cnt_b = 0;
	cnt_w = 0;
	while (i < N) {
		while (S[i] == '#'&&i < N) {
			cnt_b++;
			i++;
			if (i == N)break;

			while (S[i] == '.') {
				cnt_w++;
				i++;
				if (i == N)break;
			}
		}
		i++;
	}

	reverse(S.begin(), S.end());
	j == 0;
	while (S[j] == '#'&&j < N) {
		cnt_b--;
		j++;
	}

	cout << min(cnt_b,cnt_w) << endl;
}