#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, ans = 0, contS = 0;
  string S;
  cin >> N >> S;
  for (int i = 0; i < S.length() - 1; i++) {
    if (S[i] == '#') {
      contS++;
    }
    if (S[i] == '.') {
      contS = 0;
    }
    if (S[i] == '#' && S[i + 1] == '.') {
      int contD = 0;
      i++;
      while (S[i] == '.' && i < S.length()) {
        contD++;
        i++;
      }
      i--;
      if (contD <= contS) {
        contS += contD;
      }
      ans += min(contS, contD);
    }
  }
  cout << ans << endl;
  return 0;
}
