#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using u128 = __uint128_t;

#define int long long
#define idxSet tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define atIdx find_by_order
#define idxOf order_of_key
#define MOD 1000000007
#define MAX 200005
#define endl '\n'

#define v(type) vector<type>
#define p(type1, type2) pair<type1 , type2>
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int dp[MAX][2];

void solve() {
    int n;
    cin>>n;
    string x;
    cin>>x;
    int ith = 0;
    if(x[0] == '.'){
        while(ith < n && x[ith] != '#'){
            ith++;
        }
    }
    vi d;
    for(int i = ith ; i < n ; ){
        int j = i , c = 0;
        while(j < n && x[j] == x[i]){
            c++;
            j++;
        }
        d.push_back(c);
        i = j;
    }
    if(x[n-1] == '#'){
        d.pop_back();
    }

    if(d.size() == 0){
        cout<<0<<endl;
    }else {
        int k = 0;
        dp[k][0] = d[0];
        dp[k][1] = d[1];
        k++;
        for(int i = 2 ; i < d.size() ; i+= 2){
            dp[k][0] = min(dp[k-1][1]  , dp[k-1][0] ) + d[i];
            dp[k][1] = min(dp[k-1][1] , dp[k-1][0]) + d[i+1];
            k++;
        }
        cout<<min(dp[k-1][0] , dp[k-1][1]);
    }
}

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    //cin>>t;
    while (t--)
        solve();
    return 0;
}