#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, black = 0, white = 0, ans = 0;
  bool found = false, fs = false;
  string s;
  cin >> n >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '#') found = 1;
    if (found == 1 && s[i] == '#') {
      if (fs == 1) {
        ans += min(white, black);
        fs = 0;
        black = 0;
        white = 0;
      }
      black++;
    }
    if (found == 1 && s[i] == '.') {
      fs = true;
      white++;
    }
    if (i == n - 1) ans += min(white, black);
  }
  cout << ans;
  return 0;
}
