#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int INF = 1000000;
const double PI = 3.14159265359;
int main() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  long long ans = 0;
  long long w = 0, b = 0, btow = 0, wtob = 0;
  bool e = false;
  for (long long i = n - 1; i >= 0; i--) {
    if (s[i] == '.') {
      e = false;
      if (b <= w + btow) {
        w++;
        b = 0;
        btow += b;
      } else {
        ans += w;
        btow = 0;
        w = 1;
        b = 0;
      }
    } else {
      b++;
    }
  }
  if (w != 0 || b != 0) ans += min(w, b);
  cout << ans << endl;
  return 0;
}
