#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long int n;
  string s;
  cin >> n >> s;
  long long int white = 0;
  long long int black = 0;
  long long int ans = 0;
  bool w = false;
  for (long long int i = 0; i < n; i++) {
    if (w) {
      if (s[i] == '.') {
        white++;
      } else {
        w = false;
        ans += min(black, white);
        black = 1;
        white = 0;
      }
      continue;
    }
    if (s[i] == '#') {
      black++;
    } else {
      w = true;
      white++;
    }
  }
  ans += min(black, white);
  cout << ans << endl;
}
