#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define INF 1e9
#define MOD 1e9+7
typedef long long llong;
using namespace std;

int main(){
	int n;
	string s;
	cin>>n>>s;
	
	int sum=0;//w.
	int summ=0;//b.
	int cnt=0;
	int j;
	for(j=n-1;j>=0;--j){
		if(s[i]!='#'){
			cnt++;
			break;
		}
	}
	for(int i=j-1;i>=0;--i){
		if(s[i]=='.') cnt++;
		else{
			summ++;
			sum+=cnt;
			cnt=0;
		}
	}
	
	cout<<min(sum,summ)<<endl;
}