#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF (2e9)
#define EPS (1e-7)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main() {
    ll n;
    string s;
    cin >> n;
    cin >> s;
    ll fb;
    ll ans;

    for(ll i = 0; i < n; i++) {
        if (s[i] == '#') {
            fb = i;
            break;
        }
        ans = 0;
    }

    ll b = 0;
    ll w = 0;
    for(ll i = m; i < n; i++) {
        if (s[i] == '#') {
            b++;
        } else {
            w++;
        }
    }

    if (b > w) {
        ans = w;
    } else {
        ans = b;
        if (s[n-1] == '#') {
            ans--;
        }
    }
    cout << ans << endl;
}