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