#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n;
  cin >> s;
  int ans = 0;
  int black, white;
  bool mode;
  int i = 0;
  for (i = 0; i < n; i++) {
    if (s[i] == '#') {
      break;
    }
  }
  black = 0;
  mode = true;
  for (; i < n; i++) {
    if (mode) {
      if (s[i] == '#') {
        black++;
        continue;
      } else {
        mode = false;
        white = 1;
        continue;
      }
    } else {
      if (s[i] == '.') {
        white++;
        continue;
      } else {
        if (black < white) {
          ans += black;
        } else {
          ans += white;
        }
        black = 1;
        mode = true;
      }
    }
  }
  if (!mode) {
    if (black < white) {
      ans += black;
    } else {
      ans += white;
    }
  }
  cout << ans << endl;
  return 0;
}
