#include <bits/stdc++.h>
using namespace std;
static const long long MOD = 1000000007;
int ans;
int main(void) {
  int n;
  string s;
  cin >> n >> s;
  int i = 0;
  while (i < n - 1) {
    if (s[i] == '#' && s[i + 1] == '.') {
      int b = 0, w = 0;
      while (i + 1 + w < n && s[i + 1 + w] == '.') w++;
      while (i - b >= 0 && s[i - b] == '#' && b < w) b++;
      if (b < w) {
        ans += b;
      } else {
        ans += w;
        for (int j = 0; j < w; j++) s[i + 1 + j] = '#';
      }
      i += w + 1;
    } else {
      i++;
    }
  }
  cout << ans << endl;
  return 0;
}
