#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0)->sync_with_stdio(false);
  int n;
  cin >> n;
  string s;
  cin >> s;
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == '#')
      s.pop_back();
    else
      break;
  }
  reverse(s.begin(), s.end());
  n = (int)s.size();
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == '.')
      s.pop_back();
    else
      break;
  }
  reverse(s.begin(), s.end());
  n = (int)s.size();
  if (n == 0)
    cout << 0 << '\n';
  else {
    int cntB = 0;
    int cntW = 0;
    for (int i = 0; i < (n); i++) {
      if (s[i] == '#')
        cntB++;
      else
        cntW++;
    }
    cout << min(cntB, cntW) << '\n';
  }
  return 0;
}
