#include<iostream>
using namespace std;
int n,b[200005],w[200005],minf=1145141,p,pp;
string s;
int main(){
    cin>>n>>s;
    for(int i=0;i<n;i++){
        if(s[i]=='#')p++;
        b[i]=p;
    }
    for(int i=n-1;i>=0;i--){
        if(s[i]=='.')pp++;
        w[i]=pp;
    }
    for(int i=0;i<n;i++) if(minf>(b[i]+w[i]-1))minf=b[i]+w[i]-1;
    cout<<minf<<endl;
}