#include <bits/stdc++.h>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;

int main(){
	int n; cin >>n;
	string s; cin >>s;
	vector<int>a;
	int i=0;
	int cnt=1;
	while(i<s.size()-1){
      if(s[i]==s[i+1] ){
      	cnt++;
      	i++;
      }
      else{
      	a.push_back(cnt);
      	cnt=1;
      	i++;
      }
	}
    a.push_back(cnt);
    int bsum=0;
    int wsum=0;
    
    if(s[0]=='.'){
    	int ans=20000000;
    	for(int i=1;i<a.size();i+=2)
    		bsum+=a[i];
    	for(int i=2;i<a.size();i+=2)
    		wsum+=a[i];
    	if(a.size()%2 ==0){
    		int cntb=bsum;
    		int cntw=wsum;
    		ans=min(ans,cntb);
    		ans=min(ans,cntw);
    		cntb=0;
    		for(int i=1;i<=a.size()/2;i++){
    			cntw-=a[i*2];
    			cntb+=a[i*2-1];

    			ans=min(ans,cntb+cntw);

    		}
    	}
    	if(a.size()%2 ==1){
    		int cntb=bsum;
    		int cntw=wsum;
    		ans=min(ans,cntb);
    		ans=min(ans,cntw);
    		cntb=0;
    		for(int i=1;i<=(a.size()-1)/2;i++){
    			cntw-=a[i*2];
    			cntb+=a[i*2-1];

    			ans=min(ans,cntb+cntw);

    		}
    	}


    }
    if(s[0]=='#'){
    	int ans=20000000;
    	for(int i=0;i<a.size();i+=2)
    		bsum+=a[i];
    	for(int i=1;i<a.size();i+=2)
    		wsum+=a[i];
    	if(a.size()%2 ==1){
    		int cntb=bsum;
    		int cntw=wsum;
    		ans=min(ans,cntb);
    		ans=min(ans,cntw);
    		cntb=0;
    		for(int i=1;i<=(a.size()+1)/2;i++){
    			cntw-=a[i*2-1];
    			cntb+=a[i*2-2];

    			ans=min(ans,cntb+cntw);

    		}
    	}
    	if(a.size()%2 ==0){
    		int cntb=bsum;
    		int cntw=wsum;
    		ans=min(ans,cntb);
    		ans=min(ans,cntw);
    		cntb=0;
    		for(int i=1;i<=(a.size()-1)/2;i++){
    			cntw-=a[i*2-1];
    			cntb+=a[i*2-2];

    			ans=min(ans,cntb+cntw);

    		}
    	}


    }
    cout << ans << endl;
}
