#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, w_count = 0, b_count = 0, count = 0;
  bool f = false;
  string s;
  cin >> n >> s;
  s += "#";
  for (auto &&i = s.begin(); i < s.end(); i++) {
    if (*i == '#') {
      if (!f) {
        count += (b_count < w_count) ? b_count : w_count;
        b_count = 1;
        w_count = 0;
        f = true;
      } else {
        b_count++;
      }
    } else {
      w_count++;
      if (f) f = false;
    }
  }
  cout << count << endl;
}
