#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> cnt_vcb(n);
  vector<int> cnt_vcw(n);
  int cnt_b = 0, cnt_w = 0;
  int maxi = 0;
  int i_tmp = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '.')
      cnt_w++;
    else
      cnt_b++;
    cnt_vcw[i] = cnt_w;
    cnt_vcb[i] = cnt_b;
    if (maxi < (cnt_vcw[i] - cnt_vcb[i])) {
      maxi = cnt_vcw[i] - cnt_vcb[i];
      i_tmp = i;
    }
  }
  if (i_tmp == 0)
    cout << min(cnt_vcb[n - 1], cnt_vcw[n - 1]) << endl;
  else
    cout << cnt_vcb[i_tmp] + cnt_vcw[n - 1] - cnt_vcw[i_tmp] << endl;
}
