#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  string S;
  cin >> N >> S;
  int ans = 0;
  for (int x = 0; x < (N); x++) {
    if (S.at(x) == '#') {
      int black = 0, white = 0;
      while (x < N && S.at(x) == '#') {
        x++;
        black++;
      }
      while (x < N && S.at(x) == '.') {
        x++;
        white++;
      }
      if (white > 0) {
        ans += min(black, white);
      }
      x--;
    }
  }
  cout << ans << endl;
}
