#include <iostream>
using namespace std;
int main(void){
    int n,ans=0,ans2=0;
    char s[200100];
   cin >> n >> s;
   
   int brack=0,white=0;
   
   for(int i=0;i<n;i++){
   		if(s[i]=='#')brack++;
   		else white++;
   		}
   for(; ans<n;ans++){
   		if(s[ans]=='.')break;
   		}
	for(; ans2<n;ans2++){
   		if(s[n-ans2-1]=='#')break;
   		}   
   cout <<min(white-ans2, brack-ans1); 
}