#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  string t = s;
  int ans = 0;
  int c1 = 0, c2 = 0;
  for (int i = 0; i < n; ++i) {
    if (i == n - 1) {
    }
    if (s[i] == '.') {
      if (c2) c1++;
    } else {
      if (c1) {
        ans += min(c1, c2);
        c1 = 0, c2 = 0;
      } else {
        c2++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
