#include <bits/stdc++.h>
using namespace std;
#define ll long long
inline int read() {
	int f=1,x=0;char ch=getchar();
	while(!isdigit(ch)) {if(ch=='-') f=-1;ch=getchar();}
	while(isdigit(ch)) {x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
int main() {
	int n,a=0,b=0;
	char str[200005];
	n=read();
	scanf("%s",str);
	for(int i=0;i<n;i++) {
		if(str[i]=='#')a++;
		if(str[i]=='.'&&a>0)b++,a--;
	}
	printf("%d",b);
	return 0;
}