#include <bits/stdc++.h>
using namespace std;
int N;
string S;
int main() {
  cin >> N >> S;
  int ctb = 0;
  int ctw = 0;
  int p = 0;
  int q = 0;
  int ans = 0;
  for (int i = 0; i < (N + 1); ++i) {
    if (S[i] == '#')
      p = 1;
    else if (p == 1 && S[i] == '.')
      q = 1;
    if (p == 1 && q == 1 && (S[i] == '#' || i == N)) {
      ans += min(ctb, ctw);
      ctb = 0;
      ctw = 0;
      q = 0;
    }
    if (p == 1) {
      if (S[i] == '#')
        ctb++;
      else
        ctw++;
    }
  }
  cout << ans << endl;
}
