#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  string s;
  int scount = 0;
  int dcount = 0;
  int count = 0;
  cin >> a >> s;
  for (int i = 0; i < a; i++) {
    if (s[i] == '#') {
      while (s[i] == '#') scount++;
    }
    if (s[i] == '.' && scount != 0) {
      while (s[i] == '.') dcount++;
      count = count + min(scount, dcount);
      scount = 0;
      dcount = 0;
    }
  }
  cout << count << endl;
  return 0;
}
