#include <bits/stdc++.h>
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, -1, 0, 1};
using namespace std;
int main(void) {
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  int id = 0;
  for (int i = 0; i < s.size() - 1; i++) {
    if (s[i] == '#' and s[i + 1] == '.') {
      int l = i, r = i + 1;
      while (l >= 0 and s[l] == '#') {
        if (l == 0) break;
        l--;
      }
      while (r < s.size() and s[r] == '.') {
        if (r == s.size() - 1) break;
        r++;
      }
      ans += min((i - l + 1), (r - (i + 1) + 1));
      i = r;
    }
  }
  cout << ans << endl;
  return 0;
}
