#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
namespace mp = boost::multiprecision;
#define ll long long
#define cpp mp::cpp_int
#define dequeue deque
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = 1; i <= n; i++)
#define drep(i, n) for(int i = n-1; i >= 0; i--)
#define srep(i, s, t) for (int i = s; i < t; i++)
#define vi vector<int>
#define P pair<ll, ll>
int mod = 1'000'000'000 + 7;
struct edge {
	int to;
	ll cost;
};

void COME_LET_THE_GAMES_BEGIN() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << setprecision(20);
}
int main() {
	COME_LET_THE_GAMES_BEGIN();
	int N;
	string S;
	cin >> N >> S;
	bool f = false;
	int a, b;
	vector<P> v;
	for (int i = 0; i < N; i++) {
		if (S[i] == '.') {
			if (!f) {
				a = i;
				f = true;
			}
			if (i == N - 1) {
				b = N;
				v.push_back(P(a, b));
				f = false;
			}
		}
		else {
			if (f) {
				b = i;
				v.push_back(P(a, b));
				f = false;
			}
		}
	}
	if (v.size() == 0) {
		cout << 0 << endl;
		return 0;
	}
	ll ans = 0;
	if (v[0].first != 0) {
		ans += min(v[0].second - v[0].first, v[0].first);
	}
	for (int i = 1; i < v.size(); i++) {
		ans += min(v[i].second - v[i].first, v[i].first - v[i - 1].second);
	}
	cout << ans << endl;
}