#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
    string s;
    ll n;
    cin>>n>>s;
    ll count11=0,count21=0,count22=0,black=0;
    string a=b=s;
    for(ll i=0;i<n;i++){
        if(count11==0){
            if(s[i]=='#'){
                count11=1;
                if(i!=n-1)count22++;
            }
        }
        else{
            if(s[i]=='.')count21++;
            if(s[i]=='#')count22++;
        } 
        if(s[i]=='.')black=0;
        if(s[i]=='#')black++;
    }

    if(count22-black>count21)cout<<count21<<endl;
    else cout<<count22-black<<endl;
}