#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
//const ll INF = 1e18;
const double EPS = 1e-10;
const int MOD = 1e9+7;
const double PI = acos(-1.0);

const int mx4[] = {0,1,0,-1};
const int my4[] = {1,0,-1,0};
const int mx8[] = {0,1,1,1,0,-1,-1,-1};
const int my8[] = {1,1,0,-1,-1,-1,0,1};

int main()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	int flag = 1;
	for(int i = 0; i < s.size(); i++){
		if(s[i] == '#') flag = 0;
	}
	if(flag){
		cout << 0 << endl;
		return 0;
	}

	int w_cnt[n+10] = {},b_cnt[n+10] = {};
	for(int i = 0; i < s.size(); i++){
		if(s[i] == '.') w_cnt[i]++;
	}
	for(int i = s.size()-1; i >= 0; i--) w_cnt[i] += w_cnt[i+1];

	for(int i = 0; i < s.size(); i++){
		if(s[i] == '#') b_cnt[i]++;
	}
	for(int i = 1; i < s.size(); i++) b_cnt[i] += b_cnt[i-1]; 

	int ma = INF;
	for(int i = 0; i < s.size(); i++){
		if(s[i] == '#'){
			if(i == 0){
				ma = min(w_cnt[i],ma);
			}else if(i == s.size()-1){
				ma = min(b_cnt[i]-1,ma);
			}else{
				ma = min(b_cnt[i]-1+w_cnt[i+1],ma);
			}
		}
	}
	cout << ma << endl;
	return 0;
}