#include <bits/stdc++.h>
using namespace std;
using ll = unsigned long long;
int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> num;
  char before = 'a';
  int count = 0;
  bool start = false;
  for (int i = 0; i < s.size(); i++) {
    if (!start && s[i] == '#') {
      start = true;
    }
    if (start) {
      if (before != s[i]) {
        num.push_back(count);
        before = s[i];
        count = 1;
      } else {
        count++;
      }
    }
  }
  num.push_back(count);
  int result = 0;
  for (int i = 1; i < num.size(); i += 2) {
    result += min(num[i], num[i + 1]);
  }
  cout << result << endl;
}
