#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define ll long long
#define maxn 300005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));

int main(){
	int n;
	while(cin >> n){
		string s;
		cin>>s;
		int cnt=0;
		int dp[n+5]={};
		int dp2[n+5]={};
		for(int i=0;i<n;i++){
			if(s[i]=='#'){
				cnt++;
			}
			dp[i]=cnt;
		}
		cnt=0;
		for(int i=n-1;i>=0;i--){
			if(s[i]=='.')
				cnt++;
			dp2[i]=cnt;
		}
		int Min=n;
		if(!dp[n-1]){
			cout<<0<<endl;
			exit(0);
		}
		for(int i=0;i<n;i++){
			if(s[i]=='#'){
				Min=min(dp[i-1]+dp2[i+1],Min);
			}
		}
		cout<<Min<<endl;
	}

}