#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n; cin >> n;
    string s; cin >> s;

    ll sum_b[n+1] = {};
    ll sum_w[n+1] = {};

    reps(i, 1, n+1){
        if(s[i-1] == '.'){
            sum_w[i] = sum_w[i-1] + 1;
            sum_b[i] = sum_b[i-1];
        }
        else{
            sum_b[i] = sum_b[i-1] + 1;
            sum_w[i] = sum_w[i-1];
        }
    }

    // rep(i, n+1){
    //     cout << sum_w[i] << " " << sum_b[i] << endl;
    // }

    ll ans = 1e18;

    // bool allsame = true;
    rep(i, n-1){
        if(s[i] == '.' && s[i+1] == '#'){
            ll left = sum_b[i+1];
            ll right = sum_w[n] - sum_w[i+1];
            cout << i << " " << left << " " << right << endl;
            ll temp = sum_b[i+1] + sum_w[n] - sum_w[i+1];
            ans = min(temp, ans);
            // allsame = false;
        }
        else if(s[i] == '#' && s[i+1] == '.'){
            // allsame = false;
        }
    }

    ans = min(ans, sum_w[n]);
    ans = min(ans, sum_b[n]);

    cout << ans << endl;


    return 0;
}