#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  string S;
  cin >> N >> S;
  int b = 0;
  int w = 0;
  int count = 0;
  bool flag = false;
  for (int i = 0; i < N; i++) {
    if (S[i] == '#') {
      b++;
    } else {
      if (b == 0) continue;
      w++;
      if (i + 1 < N) {
        if (S[i + 1] == '#') {
          count += ((b < w) ? b : w);
          b = 0;
          w = 0;
        }
      } else {
        count += ((b < w) ? b : w);
      }
    }
  }
  cout << count << endl;
}
