#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  string s;
  cin >> n >> s;
  long long result = 0;
  if (n != 1) {
    long long wCount = 0, bCount = 0;
    bool b = false;
    for (long long i = 0; i < n; ++i) {
      if (s[i] == '.') {
        if (b) {
          b = false;
        }
        ++wCount;
      } else {
        if (!b) {
          if (wCount < bCount) {
            result += wCount;
            bCount = 0;
          } else {
            result += bCount;
            wCount = 0;
            b = true;
          }
        }
        ++bCount;
      }
    }
    if (!b) {
      result += min(wCount, bCount);
    }
  }
  cout << result << endl;
}
