#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first.first
#define yy first.second
#define __V vector
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define oit ostream_iterator
#define mod ((__int128)1000000007)
using namespace __gnu_pbds;
using namespace std;
void doin() {
	cin.tie();
	cout.tie();
	ios::sync_with_stdio(0);
#ifdef LOCAL
//	freopen("in", "r", stdin);
#endif
}
typedef long long ll;
typedef ll _I;
typedef double ld;
typedef pair<_I, _I> pi;
typedef pair<ld, ld> pd;
typedef map<_I, _I> mii;
typedef __V <_I> vi;
typedef __V <char> vc;
typedef __V <ld> vd;
typedef __V <pi> vpi;
typedef __V <__V<_I>> vvi;
typedef __V <__V<char>> vvc;
typedef __V <__V<pi>> vvpi;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, dp[200005][2];
string s;
char t[2] = {'.', '#'};

int main() {
	doin();
	cin >> n >> s;
	for (int i = 0; i <= n; i++)
		dp[0][i] = dp[i][1] = 1000000000;
	dp[0][0] = dp[0][1] = 0;
	for (int i = 1; i <= n; i++) {
		if(s[i-1] == '.'){
			dp[i][0] = min(dp[i-1][1]+1, dp[i-1][0]);
			dp[i][1] = 1+min(dp[i-1][0], dp[i-1][1]);
		} else {
			dp[i][0] = 1+min(dp[i-1][1], dp[i-1][0]);
			dp[i][1] = min(dp[i-1][0], dp[i-1][1]);
		}
	}
	cout << min(dp[n][0], dp[n][1]);
}

