#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans = 0, cou = 0, coum = 0;
  char s[200000];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  for (int i = 0; i < n - 1; i++) {
    if (s[i] == '#') {
      if (s[i + 1] == '.') {
        cou = 1;
        coum = 1;
        for (int c = i + 1; c <= n - i - 1; c++) {
          if (s[c] == '.') {
            cou++;
          } else {
            break;
          }
        }
        for (int a = i - 1; a <= i - cou; i--) {
          if (s[a] == '#') {
            coum++;
          } else {
            break;
          }
        }
        if (cou > coum) {
          ans += coum;
          i += cou;
        }
        if (cou <= coum) {
          ans += cou;
          i += cou;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
