#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  int ans = 0;
  string S;
  cin >> N >> S;
  for (int i = 0; i < N; i++) {
    if (S[i] == '#') {
      int idx = i;
      int black, white;
      black = white = 0;
      while (idx < N) {
        if (white > 0 && S[idx] == '#') break;
        if (S[idx] == '.')
          white++;
        else
          black++;
        idx++;
      }
      ans += min(black, white);
      i = idx;
    }
  }
  cout << ans << endl;
  return 0;
}
