#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  int i = 0;
  int ans = 0;
  while (i < n) {
    while (i < n && s[i] != '#') ++i;
    int cntb = 0, cntw = 0;
    while (i < n && (cntw == 0 || s[i] == '.')) {
      if (s[i] == '#')
        cntb++;
      else
        cntw++;
      ++i;
    }
    ans += min(cntb, cntw);
  }
  cout << ans << endl;
  return 0;
}
