#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  int cont = 1;
  vector<int> vec;
  for (int i = 1; i < n; i++) {
    if (s[i] == s[i - 1]) {
      cont++;
    } else {
      vec.push_back(cont);
      cont = 1;
    }
  }
  vec.push_back(cont);
  if (s[0] == '.') vec.erase(vec.begin());
  int len = vec.size(), ans = 0, idx = -1;
  for (int i = 1; i < len; i += 2) {
    if (vec[i] < vec[i - 1]) {
      idx = i - 1;
      break;
    }
    ans += vec[i - 1];
  }
  if (idx == -1) {
    cout << ans << endl;
    return 0;
  }
  int bk = 0, wt = 0;
  for (int i = idx; i < len; i += 2) bk += vec[i];
  for (int i = idx + 1; i < len; i += 2) wt += vec[i];
  cout << ans + min(bk, wt) << endl;
  return 0;
}
